{"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second."}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains?"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4."}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry."}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains?"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2."}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second."}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 10, dur 0.2, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.15, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second."}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains?"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4."}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 16, dur 0.04, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains?"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 28, dur 0.07, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 10, dur 0.15, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.07, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 16, dur 0.07, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 16, dur 0.04, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 16, dur 0.1, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.15, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 16, dur 0.2, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 16, dur 0.07, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.2, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 20, dur 0.2, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 28, dur 0.2, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 6, dur 0.1, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.15, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains?"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 20, dur 0.2, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.1, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 6, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 10, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 16, dur 0.2, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 6, dur 0.15, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.07, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.2, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 6, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 6, dur 0.15, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 20, dur 0.2, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 10, dur 0.1, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.15, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 10, dur 0.07, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 10, dur 0.1, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 6, dur 0.04, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 10, dur 0.07, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 14, dur 0.2, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 16, dur 0.2, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.2, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 10, dur 0.1, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2. (rate 28, dur 0.1, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.2, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.04, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 10, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 14, dur 0.15, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 6, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.15, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 6, dur 0.07, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 20, dur 0.07, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 16, dur 0.15, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 20, dur 0.15, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 14, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.07, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.07, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 20, dur 0.04, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 20, dur 0.04, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.1, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.2, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 20, dur 0.1, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 16, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.07, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.15, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 14, dur 0.04, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 16, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 14, dur 0.1, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4."}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 16, dur 0.1, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.2, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 28, dur 0.2, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 10, dur 0.04, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.2, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.04, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 20, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 14, dur 0.07, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.07, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.04, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 14, dur 0.04, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 14, dur 0.07, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 16, dur 0.15, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 10, dur 0.15, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 14, dur 0.04, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 6, dur 0.1, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.15, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 6, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 28, dur 0.07, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 6, dur 0.04, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 20, dur 0.04, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 16, dur 0.04, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.04, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 16, dur 0.15, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 6, dur 0.04, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 10, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.07, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 6, dur 0.2, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 28, dur 0.07, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.2, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.1, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 6, dur 0.2, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 14, dur 0.1, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 16, dur 0.1, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 6, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 10, dur 0.15, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.07, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.04, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 14, dur 0.2, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 20, dur 0.1, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.2, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 20, dur 0.07, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 10, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.04, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 10, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 6, dur 0.04, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.2, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.1, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 28, dur 0.15, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 6, dur 0.07, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 6, dur 0.04, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.2, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 6, dur 0.2, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2. (rate 20, dur 0.2, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 28, dur 0.04, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.04, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 10, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 16, dur 0.2, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 28, dur 0.2, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.04, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 6, dur 0.1, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 10, dur 0.2, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.07, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 16, dur 0.07, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 10, dur 0.15, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 28, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.2, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 16, dur 0.07, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 6, dur 0.2, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.04, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.07, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 20, dur 0.15, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 16, dur 0.1, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 6, dur 0.15, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.2, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 14, dur 0.04, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 14, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 28, dur 0.07, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.1, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 28, dur 0.15, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2. (rate 6, dur 0.07, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.07, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 6, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 14, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.07, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.07, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 10, dur 0.04, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 10, dur 0.07, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 10, dur 0.1, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.15, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 6, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 4. (rate 20, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 10, dur 0.07, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 28, dur 0.1, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 20, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.1, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.15, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 16, dur 0.1, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 10, dur 0.1, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.04, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.2, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 14, dur 0.1, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 16, dur 0.1, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.07, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 20, dur 0.04, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 6, dur 0.1, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.04, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.15, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 16, dur 0.07, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 14, dur 0.04, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 10, dur 0.04, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 16, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 6, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 28, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 28, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 10, dur 0.07, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.04, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.15, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2. (rate 16, dur 0.07, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 10, dur 0.04, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.07, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 20, dur 0.1, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 28, dur 0.15, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 6, dur 0.1, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 20, dur 0.04, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 6, dur 0.04, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.04, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.07, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 10, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 4. (rate 20, dur 0.07, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.2, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 10, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 28, dur 0.04, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.04, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.1, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 20, dur 0.1, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 28, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.2, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 6, dur 0.15, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.15, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 28, dur 0.2, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 28, dur 0.07, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.1, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 14, dur 0.04, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 28, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 20, dur 0.15, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.04, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 16, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 16, dur 0.15, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.07, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 14 grains per second. (rate 14, dur 0.04, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 28, dur 0.2, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 28, dur 0.07, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 10, dur 0.07, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.2, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.07 s grains? (rate 16, dur 0.07, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 20, dur 0.07, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 20, dur 0.1, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.15, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 10, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 6, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.07, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 2, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 28, dur 0.2, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 10, dur 0.2, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.1, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 28, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.07, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 28 grains per second. (rate 28, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 16, dur 0.2, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 20, dur 0.2, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.2, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.1 s grains? (rate 10, dur 0.1, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 6, dur 0.15, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.07, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 10 grains per second. (rate 10, dur 0.15, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 16, dur 0.04, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 4. (rate 16, dur 0.04, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 10, dur 0.07, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.04, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 16, dur 0.2, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 28, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.07, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.2, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.15 s grains? (rate 28, dur 0.15, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2. (rate 28, dur 0.15, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry. (rate 14, dur 0.1, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay."}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 55 Hz?"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep."}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click."}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay."}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 48 Hz?"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click."}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay."}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz?"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep."}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click."}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc saw, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz?"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep."}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.18, f0 180, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay."}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz?"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click."}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc saw, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz?"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc sine, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay."}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz?"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc saw, sweep 0.06, decay 0.5, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc saw, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 48 Hz?"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc saw, sweep 0.06, decay 0.18, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc saw, sweep 0.06, decay 0.12, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc sine, sweep 0.06, decay 0.25, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc saw, sweep 0.06, decay 0.25, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc sine, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.5, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.35, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc sine, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc fm, sweep 0.06, decay 0.35, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc saw, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc saw, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc saw, sweep 0.06, decay 0.5, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc saw, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc saw, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc saw, sweep 0.06, decay 0.12, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc sine, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 55 Hz?"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.35, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.25, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc saw, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.18, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.5, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc fm, sweep 0.06, decay 0.18, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc saw, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.5, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc sine, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.12, f0 180, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.5, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc fm, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.5, f0 220, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.5, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc saw, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc saw, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc fm, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.12, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 180, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.12, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc sine, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc sine, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.35, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc saw, sweep 0.06, decay 0.35, f0 180, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc saw, sweep 0.06, decay 0.5, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc fm, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.5, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc saw, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.5, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc saw, sweep 0.06, decay 0.12, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.35, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.5, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.12, f0 180, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc sine, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc saw, sweep 0.06, decay 0.25, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc sine, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.25, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.18, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.35, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.5, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc saw, sweep 0.06, decay 0.5, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc saw, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc fm, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.18, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.5, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc fm, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.35, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 180, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc saw, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.35, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with a click. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc saw, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc sine, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.18, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 180, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc saw, sweep 0.06, decay 0.25, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with no click. (osc sine, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc sine, sweep 0.06, decay 0.35, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.35, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc sine, sweep 0.06, decay 0.35, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.35, f0 220, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc saw, sweep 0.06, decay 0.25, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc fm, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.5, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.5, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc saw, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.25 s decay. (osc fm, sweep 0.06, decay 0.25, f0 180, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.35, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc saw, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 200 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz?"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_55_3200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_55_3200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_110_200, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 3200 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_220_3200, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz?"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_220_200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_220_2400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_165_1400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 200 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_165_200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz?"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_110_400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 1400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_110_1400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_165_2400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 2400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_55_2400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz?"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_165_3200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 3200 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_220_3200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 2400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_165_2400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_55_400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 2400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 1400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 1400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_165_1400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 3200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_55_3200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_55_200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 200 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_165_200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_165_400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_55_1400, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 200 Hz low-pass. (ugens sine, cutoff 200, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_55_200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens saw, cutoff 800, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_55_800, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_220_400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens blip, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_165_1400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 200 Hz low-pass. (ugens sine, cutoff 200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_220_200, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 800, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_220_800, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 2400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_165_2400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens tri, cutoff 3200, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_55_800, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 1400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_220_1400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens tri, cutoff 200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_82_200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens saw, cutoff 400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_165_400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 3200 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_110_3200, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens tri, cutoff 3200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_165_3200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_110_200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens blip, cutoff 800, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 800 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_165_800, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 2400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_165_2400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 800, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_82_800, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_220_1400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 1400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens tri, cutoff 800, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_165_800, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 800, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_55_800, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_165_200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 200 Hz low-pass. (ugens saw, cutoff 200, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_220_200, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens sine, cutoff 400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_55_400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens tri, cutoff 200, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_220_200, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 3200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_165_3200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_55_400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens sine, cutoff 2400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_110_2400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 3200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_220_400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_110_400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens tri, cutoff 800, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_165_800, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens saw, cutoff 3200, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_55_3200, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens blip, cutoff 1400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_165_1400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 3200 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_165_3200, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_110_200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 2400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens blip, cutoff 400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_220_400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 1400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_220_1400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens tri, cutoff 200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_55_200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens saw, cutoff 1400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_110_1400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens saw, cutoff 1400, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_55_1400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 3200 Hz low-pass. (ugens sine, cutoff 3200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_55_3200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_165_400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 2400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens saw, cutoff 200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_55_200, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 200 Hz low-pass. (ugens blip, cutoff 200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_55_200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens tri, cutoff 3200, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_220_3200, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens saw, cutoff 400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_82_400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens tri, cutoff 800, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_220_800, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 3200 Hz low-pass. (ugens blip, cutoff 3200, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_220_3200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz?"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_82_400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 800, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_220_800, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens saw, cutoff 1400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_55_1400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 400 Hz low-pass. (ugens tri, cutoff 400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_220_400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens blip, cutoff 200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_55_200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_110_400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens sine, cutoff 200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_55_200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 200 Hz low-pass. (ugens blip, cutoff 200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_165_200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_165_200, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_82_400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 200, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_220_200, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 2400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_165_2400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 3200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_165_3200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 200, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_82_200, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens tri, cutoff 400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_220_400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 2400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_110_2400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens sine, cutoff 1400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 800, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_220_800, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 3200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 800 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_110_800, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens blip, cutoff 3200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_55_3200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_110_400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_55_1400, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 2400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_220_2400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_110_200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens tri, cutoff 2400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens blip, cutoff 400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_220_400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 200 Hz low-pass. (ugens sine, cutoff 200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_55_200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens tri, cutoff 2400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_220_2400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 200, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_220_200, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_220_400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 3200 Hz low-pass. (ugens saw, cutoff 3200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_165_3200, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens blip, cutoff 400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_55_400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_110_400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens saw, cutoff 400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_165_400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_55_800, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens tri, cutoff 800, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_220_800, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_165_400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens sine, cutoff 1400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_165_1400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 2400 Hz low-pass. (ugens saw, cutoff 2400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_110_2400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens sine, cutoff 3200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_110_3200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 1400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_165_1400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 3200 Hz low-pass. (ugens sine, cutoff 3200, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens saw, cutoff 200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_110_200, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_82_400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_55_2400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 800 Hz low-pass. (ugens saw, cutoff 800, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_110_800, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens blip, cutoff 1400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_55_1400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 2400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_110_2400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_165_1400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 1400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_55_1400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens sine, cutoff 200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_110_200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 800, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_82_800, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 3200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 200 Hz low-pass. (ugens saw, cutoff 200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 2400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_110_2400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 1400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_220_1400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens blip, cutoff 3200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_55_400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 800, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_110_800, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 800, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_110_800, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens sine, cutoff 3200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_110_3200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 200 Hz low-pass. (ugens sine, cutoff 200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_82_200, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens tri, cutoff 200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_110_200, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 2400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_220_2400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens tri, cutoff 200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_82_200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 800 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_165_800, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens sine, cutoff 3200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_55_3200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 3200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_220_3200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens sine, cutoff 400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_220_400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 800 Hz low-pass. (ugens tri, cutoff 800, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_82_800, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens sine, cutoff 800, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_55_800, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 1400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_165_1400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens sine, cutoff 2400, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_55_2400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 400 Hz low-pass. (ugens tri, cutoff 400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_55_400, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens tri, cutoff 2400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_165_2400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 3200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_110_3200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens tri, cutoff 400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_110_400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 3200 Hz low-pass. (ugens tri, cutoff 3200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_55_3200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens saw, cutoff 3200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_110_3200, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 3200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens saw, cutoff 2400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_55_2400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 400 Hz low-pass. (ugens saw, cutoff 400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_110_400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 800, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_220_800, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_82_400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens sine, cutoff 2400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_165_2400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 400 Hz low-pass. (ugens tri, cutoff 400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_220_400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_165_200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 3200, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_220_3200, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens blip, cutoff 200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_220_200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 1400 Hz low-pass. (ugens blip, cutoff 1400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_220_1400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens saw, cutoff 2400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_110_2400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 2400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_220_2400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens sine, cutoff 800, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_165_800, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 1400 Hz low-pass. (ugens tri, cutoff 1400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_220_1400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 2400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_220_2400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 800, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_55_800, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 2400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_220_2400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_110_800, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 800, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_220_800, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 200, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_55_200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens tri, cutoff 400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_82_400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_55_800, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens blip, cutoff 1400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_220_1400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 1400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_110_1400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens saw, cutoff 400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_165_400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 200 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_55_200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens blip, cutoff 200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens saw, cutoff 200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_165_200, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens sine, cutoff 1400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 3200 Hz low-pass. (ugens saw, cutoff 3200, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_220_3200, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens saw, cutoff 800, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_55_800, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 200, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 2400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 200 Hz low-pass. (ugens tri, cutoff 200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_220_200, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens sine, cutoff 2400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens saw, cutoff 200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_110_200, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 800, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 800 Hz low-pass. (ugens sine, cutoff 800, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_220_800, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 3200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_165_3200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_110_400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 3200 Hz low-pass. (ugens tri, cutoff 3200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_110_3200, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens blip, cutoff 1400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens saw, cutoff 2400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_165_2400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens saw, cutoff 1400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_110_1400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_165_800, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 1400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_110_1400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_165_400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens sine, cutoff 2400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_55_2400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 2400 Hz low-pass. (ugens tri, cutoff 2400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_55_2400, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_165_200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 2400, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_220_2400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens blip, cutoff 3200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_165_3200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 800 Hz low-pass. (ugens sine, cutoff 800, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_110_800, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_165_1400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 3200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_165_3200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens tri, cutoff 3200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_220_3200, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 800 Hz low-pass. (ugens tri, cutoff 800, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_110_800, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_165_1400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 3200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_165_3200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens saw, cutoff 200, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_55_200, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens sine, cutoff 800, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_82_800, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 200, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_82_200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens sine, cutoff 200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_165_200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 400 Hz low-pass. (ugens blip, cutoff 400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_110_400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_220_400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 2400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_55_2400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 2400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_220_2400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 2400 Hz low-pass. (ugens tri, cutoff 2400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens saw, cutoff 400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_110_400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_82_400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_220_200, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 1400 Hz low-pass. (ugens sine, cutoff 1400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_55_1400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens tri, cutoff 2400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_165_400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens sine, cutoff 200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_110_200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 3200 Hz low-pass. (ugens sine, cutoff 3200, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_220_3200, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 2400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_165_2400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 800, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_82_800, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens sine, cutoff 3200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_110_3200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 400 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_55_400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens tri, cutoff 2400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_165_2400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_165_200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 3200 Hz low-pass. (ugens tri, cutoff 3200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens sine, cutoff 3200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens saw, cutoff 3200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_110_3200, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 55 Hz I can retune while it plays. (ugens saw, cutoff 3200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_55_3200, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 200 Hz low-pass. (ugens sine, cutoff 200, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_220_200, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 3200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_110_3200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 800, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_55_800, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens tri, cutoff 2400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_110_2400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 3200 Hz low-pass. (ugens tri, cutoff 3200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_55_3200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 800, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_165_800, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_110_200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens sine, cutoff 1400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_110_1400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 1400 Hz low-pass. (ugens tri, cutoff 1400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_220_1400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens tri, cutoff 2400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_55_2400, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 3200, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_220_3200, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens tri, cutoff 200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_110_200, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 1400 Hz low-pass. (ugens sine, cutoff 1400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_110_1400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens saw, cutoff 200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_55_200, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens sine, cutoff 400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_110_400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 1400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 200 Hz low-pass. (ugens saw, cutoff 200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_165_200, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 800, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_165_800, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens sine, cutoff 3200, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_55_3200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens blip, cutoff 800, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 400 Hz low-pass. (ugens saw, cutoff 400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_55_400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens tri, cutoff 2400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_220_2400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 1400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_110_2400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 3200 Hz low-pass. (ugens blip, cutoff 3200, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens sine, cutoff 1400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_220_1400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_82_400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens tri, cutoff 2400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_110_2400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 1400 Hz low-pass. (ugens blip, cutoff 1400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_220_1400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 2400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_165_2400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 800, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_220_800, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_110_1400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 2400 Hz low-pass. (ugens sine, cutoff 2400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_110_2400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 3200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_220_3200, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 3200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_110_3200, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_165_400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 2400 Hz low-pass. (ugens saw, cutoff 2400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_110_2400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 82.5 Hz? (ugens sine, cutoff 1400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens tri, cutoff 2400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_220_2400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 2400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_165_2400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 200 Hz low-pass. (ugens tri, cutoff 200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_165_200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens tri, cutoff 3200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_165_3200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens blip, cutoff 800, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_110_800, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens sine, cutoff 200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_82_200, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 1400 Hz low-pass. (ugens tri, cutoff 1400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_165_1400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens sine, cutoff 400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_220_400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens saw, cutoff 800, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens blip, cutoff 1400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_110_1400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5?"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.2 rhythm."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4?"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5?"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pwalk for the degrees."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6?"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Prand, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale majorPentatonic, seq Prand, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.2, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4?"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.25 rhythm."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6?"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Pwalk, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pwalk, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.3 rhythm."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pseq, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale majorPentatonic, seq Prand, dur 0.25, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pwalk, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Prand, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.2 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pshuf, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.2 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.4, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pseq, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale majorPentatonic, seq Pseq, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pwalk, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.2 rhythm."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pseq, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale minorPentatonic, seq Pshuf, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pwalk, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.25 rhythm."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pseq, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.2 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pseq, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale minorPentatonic, seq Pshuf, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pshuf, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.2 rhythm. (scale majorPentatonic, seq Pseq, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale minorPentatonic, seq Pshuf, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pshuf, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.2 rhythm."}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pseq, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale majorPentatonic, seq Prand, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.2, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pwalk, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.25 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.3, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Prand, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.2 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pwalk, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pwalk, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale minorPentatonic, seq Pshuf, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pshuf, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pwalk, dur 0.3, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.2 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Prand, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale minorPentatonic, seq Prand, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Prand, dur 0.4, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale majorPentatonic, seq Prand, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.25, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pwalk, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Prand, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.2 rhythm. (scale majorPentatonic, seq Prand, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale minorPentatonic, seq Pseq, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pwalk, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale minorPentatonic, seq Pseq, dur 0.4, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pseq, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.2 rhythm. (scale minorPentatonic, seq Prand, dur 0.2, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Prand, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.3 rhythm. (scale majorPentatonic, seq Prand, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pwalk, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale minorPentatonic, seq Prand, dur 0.25, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Prand, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.25 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pseq, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.3 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Pseq, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale majorPentatonic, seq Prand, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Prand, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pshuf, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Prand, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.3 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Pwalk, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Prand, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pseq, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale minorPentatonic, seq Prand, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pwalk, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Pseq, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Prand, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.3, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pshuf, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pseq, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pseq, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.2 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.3, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.3, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pshuf, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pseq, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale minorPentatonic, seq Pseq, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pseq, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.2 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale majorPentatonic, seq Pseq, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.25, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Prand, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.25 rhythm. (scale majorPentatonic, seq Pseq, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Prand, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale majorPentatonic, seq Pshuf, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Pshuf, dur 0.3, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale majorPentatonic, seq Pseq, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pseq, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.2 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.4, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pseq, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pwalk, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pwalk, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale majorPentatonic, seq Prand, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pshuf, dur 0.2, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.2 rhythm. (scale minorPentatonic, seq Prand, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.3, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pseq, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pwalk for the degrees. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Pshuf, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 6? (scale majorPentatonic, seq Prand, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Prand, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.3 rhythm. (scale majorPentatonic, seq Pseq, dur 0.3, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Prand for the degrees. (scale minorPentatonic, seq Prand, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Prand, dur 0.4, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.2 rhythm. (scale majorPentatonic, seq Prand, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pseq, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with fm voices and a 0.3 rhythm. (scale minorPentatonic, seq Pseq, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Add gverb to a kick patch at room 0.85."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: gverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = GVerb.ar(sig, 68.0, 3, 0.2, 0.5, 15, 0.4, 0.3, 0.3);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a bell with damping 0.5 on the reverb."}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.3, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I put a bell in a reverb at mix 0.45?"}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.7, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick whose tail uses freeverb."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: freeverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb.ar(sig, 0.3, 0.85, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Add freeverb2 to a bell patch at room 0.85."}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.85, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a kick with damping 0.5 on the reverb."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb2 on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I put a kick in a reverb at mix 0.3?"}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: gverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = GVerb.ar(sig, 40.0, 3, 0.5, 0.5, 15, 0.4, 0.3, 0.3);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick whose tail uses freeverb. (verb freeverb, room 0.7, damp 0.2, mix 0.45, source kick)"}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.7, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Add combn to a pluck patch at room 0.85."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: combn on a pluck\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.003, 0.5, 1, -4), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n var wet = CombN.ar(sig, 0.2, 0.2, 3.4);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a bell with damping 0.2 on the reverb."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: freeverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.7, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I put a bell in a reverb at mix 0.3?"}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: combn on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = CombN.ar(sig, 0.2, 0.2, 3.4);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a bell whose tail uses freeverb."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"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": "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 `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": "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 `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": "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": "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": "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": "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": "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": "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": "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 `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 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 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 `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": "Write a minimal SuperCollider example that uses `BRZ2`."}, {"role": "assistant", "content": "```supercollider\n// Compare:\n\n{ WhiteNoise.ar(0.25) }.play;\n\n{ BRZ2.ar(WhiteNoise.ar(0.25)) }.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": "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": "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": "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 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": "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 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 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 `BrownNoise`."}, {"role": "assistant", "content": "```supercollider\n{ SinOsc.ar(BrownNoise.ar(100, 200)) * 0.1 }.play;\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 `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": "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 `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": "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": "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": "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": "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": "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 `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": "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 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": "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": "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 `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 `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": "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": "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 `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": "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 `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": "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": "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 `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 `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": "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": "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 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": "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 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": "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": "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": "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 `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 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": "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": "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": "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 `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": "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 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": "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": "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": "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 `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 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": "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": "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 `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 `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": "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": "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": "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": "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 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": "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": "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": "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": "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": "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": "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": "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": "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": "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 `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": "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": "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 `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 `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 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 `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 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": "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": "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": "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 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 `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 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 `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": "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 `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 `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": "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": "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": "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 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": "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": "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": "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 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": "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": "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 `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": "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": "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": "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 `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 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 `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 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 `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": "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 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 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": "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 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 `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 `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": "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 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 `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 `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 `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": "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 `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 `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 `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 `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 `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": "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": "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": "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": "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": "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": "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 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": "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 `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": "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 `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": "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 `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 `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 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 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 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 `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 `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 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 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": "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 `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 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": "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 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 `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": "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": "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": "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": "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 `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": "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 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": "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": "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 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": "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 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": "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": "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": "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 `NumChannels`."}, {"role": "assistant", "content": "```supercollider\n(\n{\n NumChannels.ar(\n SinOsc.ar(100, 0, 0.2), // 1 becomes 2\n 2)\n}.play\n);\n\n(\n{\n NumChannels.ar(\n SinOsc.ar([100, 200, 300], 0, 0.2), // 3 becomes 2\n 2)\n}.play\n);\n\n(\n{\n NumChannels.ar(\n SinOsc.ar([100, 200, 300, 100], 0, 0.2), // 4 becomes 2\n\n 2)\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": "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 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 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 `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 `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 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": "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": "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": "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": "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": "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": "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": "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": "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 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": "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": "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 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 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 `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 `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 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 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 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": "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 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 `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 `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 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": "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 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 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": "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 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": "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 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 `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 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": "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 `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 `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": "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": "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 `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 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": "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": "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": "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 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": "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": "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 `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": "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 `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 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": "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": "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": "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 `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": "Write a minimal SuperCollider example that uses `SpecCentroid`."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, 2048, 1);\n(\nx = {\n var in, chain, freq, rq, centroid;\n\n // freq = LFPar.kr(0.3).exprange(100, 1000);\n freq = MouseY.kr(1000, 100, 1);\n in = Blip.ar(freq, MouseX.kr(1, 100, 1));\n chain = FFT(LocalBuf(2048), in);\n centroid = SpecCentroid.kr(chain);\n centroid.poll(10);\n in.dup * 0.1\n\n}.play\n);\n\nx.free;\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": "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 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": "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 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": "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": "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 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 `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 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": "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 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 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 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": "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 `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": "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 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": "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 `TwoZero`."}, {"role": "assistant", "content": "```supercollider\n{ TwoZero.ar(WhiteNoise.ar(0.125), XLine.kr(20, 20000, 8), 1) }.play\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 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 `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 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": "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 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 `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": "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 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": "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 complete SuperCollider patch built around `LFPulse` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n4.insp;\n[1,2,3].insp;\nPageLayout.insp;\nSynthDef(\"yawn\",{ arg freq=100;\n Out.ar(0,Saw.ar * LFPulse.kr(3))\n}).insp;\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 self-contained SuperCollider patch for reverbio (a SuperCollider snippet). Define every value it uses."}, {"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": "Give me a complete SuperCollider patch for flanger (a SuperCollider snippet): bind everything it needs before it is used."}, {"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": "Write a self-contained SuperCollider patch for it goes beyond vibrato too. Define every value it uses."}, {"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 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": "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": "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 SuperCollider patch for running water (simple). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\simpleRunningWater).fadeTime = 4;\n\n\nNdef(\\simpleRunningWater, {\n var mod, freq, ampMod, src;\n \n mod = {LFNoise0.ar(170)}!2;\n \n freq = mod.linexp(-1, 1, \\lowFreq.kr(400, 8), 2400).lag(0.01); // * Line.kr(1, 0.01, 40);\n ampMod = 0.5 + mod.linlin(-1, 1, 0.5, 0).lag(0.1);\n \n ampMod = ampMod * AmpComp.ar(freq);\n \n src = LPF.ar(SinOsc.ar(\n freq,\n 0.6, \n ampMod\n ), 4000);\n \n // src * LFPulse.ar(10);\n src\n \n})\n);\n\nNdef(\\simpleRunningWater).set(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).xset(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).gui\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 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 for number 10 for Quiz 4a. Start by defining the values the patch depends on."}, {"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": "Write a SuperCollider patch for Breathing Ocean (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var lew, bpf;\n lew = WhiteNoise.ar(\n mul: 0.5,\n add: 0.1); \n bpf = LPF.ar(in: lew, freq: SinOsc.kr(1/8).range(100, 800));\n Out.ar(0, bpf);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for outer beat. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```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```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Nuclear Fallout (a SuperCollider snippet). Define every value it uses."}, {"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 for Electrode Theremin (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 SuperCollider patch for We all could use a little more that runs as it is, with nothing assumed about the session."}, {"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": "Write a SuperCollider patch for 8-bit synth (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 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 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 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": "Write a self-contained SuperCollider patch for radio static with tuning noise (a SuperCollider snippet). Define every value it uses."}, {"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 for Digital Bird sounds that runs as it is, with nothing assumed about the session."}, {"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": "Give me a complete SuperCollider patch for Spring saw: bind everything it needs before it is used."}, {"role": "assistant", "content": "```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```"}]} {"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 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": "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": "Write a self-contained SuperCollider patch for Swarm of sound files. Define every value it uses."}, {"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 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 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 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 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": "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": "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": "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": "Give me a complete SuperCollider patch for poor man's panning: bind everything it needs before it is used."}, {"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": "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 self-contained SuperCollider patch for now with snooze (press mouse button). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6, now = 10|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1) * SetResetFF.kr(Dust.kr(1/now), MouseButton.kr)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Feedback resonator. Start by defining the values the patch depends on."}, {"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": "Give me a complete SuperCollider patch for Will nobody switch the damn thing off?: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Nested ifs in a SynthDef: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Wake up call: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for phasemodulation feedback and allpass network. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nn=LFNoise1;Ndef(\\x,{a=SinOsc.ar(65,Ndef(\\x).ar*n.ar(0.1,3),n.ar(3,6)).tanh;9.do{a=AllpassL.ar(a,0.3,{0.2.rand+0.1}!2,5)};a.tanh}).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, 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": "Show me a self-contained SuperCollider patch using `AnalogIn`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `AnalogOut` and actually plays. Assume nothing about the session."}, {"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": "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 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 a SuperCollider patch that uses `Ball` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a SuperCollider patch that uses `BinaryOpUGen` and actually plays. Assume nothing about the session."}, {"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": "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{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"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": "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 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": "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 `Buffer`: bind everything it needs first."}, {"role": "assistant", "content": "```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 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": "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 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 `ControlName`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `ControlSpec`. Define every value it uses."}, {"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 self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```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": "Write a self-contained SuperCollider patch that uses `Dbrown`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Ddup`: bind everything it needs first."}, {"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 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 self-contained SuperCollider patch that uses `Dgeom`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dibrown` and actually plays. Assume nothing about the session."}, {"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": "Write a complete SuperCollider patch built around `DigitalIO` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `DigitalIn`. Define every value it uses."}, {"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 SuperCollider patch that uses `DigitalOut` and actually plays. Assume nothing about the session."}, {"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 self-contained SuperCollider patch that uses `Diwhite`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Drand`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dreset`: bind everything it needs first."}, {"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": "Write a self-contained SuperCollider patch that uses `Dseq`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `Dser`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dseries` and actually plays. Assume nothing about the session."}, {"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": "Show me a self-contained SuperCollider patch using `Dshuf`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dstutter`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch1`: bind everything it needs first."}, {"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 SuperCollider patch that uses `Dust` and actually plays. Assume nothing about the session."}, {"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 complete SuperCollider patch built around `Dust2` that runs as it is."}, {"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": "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 `Dwhite`. Define every value it uses."}, {"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 complete SuperCollider patch built around `Dwrand` that runs as it is."}, {"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": "Show me a self-contained SuperCollider patch using `Dxrand`: bind everything it needs first."}, {"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": "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 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 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 SuperCollider patch that uses `FFTTrigger` and actually plays. Assume nothing about the session."}, {"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": "Write a SuperCollider patch that uses `FOS` and actually plays. Assume nothing about the session."}, {"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": "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 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": "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": "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": "Write a SuperCollider patch that uses `GrayNoise` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a complete SuperCollider patch built around `IFFT` that runs as it is."}, {"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 `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 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": "Write a self-contained SuperCollider patch that uses `MouseX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.control(s, 9); // nine channel control rate\nb.setn([244, 737, 20, 271, 382, 172, 4, 2399, 251]);\n{\n var index = MouseX.kr(0, 30);\n Blip.ar(InBus.ar(b, 2, index, \\wrap)) * 0.1\n}.play;\n)\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 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": "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 me a self-contained SuperCollider patch using `KeyTrack`: bind everything it needs first."}, {"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": "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": "Write a complete SuperCollider patch built around `LastValue` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"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 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 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 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 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": "Write a complete SuperCollider patch built around `MultiTap` that runs as it is."}, {"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 complete SuperCollider patch built around `MultiplexAnalogIn` that runs as it is."}, {"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": "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": "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": "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": "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": "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.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `NodeControl`. Define every value it uses."}, {"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": "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": "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": "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": "Show me a self-contained SuperCollider patch using `PV_BrickWall`: bind everything it needs first."}, {"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 self-contained SuperCollider patch that uses `PV_Mul`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `PV_PhaseShift`: bind everything it needs first."}, {"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": "Write a complete SuperCollider patch built around `PV_PhaseShift90` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ |out = 0, bufnum = 0|\n var in, fft, fft2, shifted;\n in = SinOsc.ar(500, 0, 0.1);\n fft = FFT(LocalBuf(2048), in);\n fft2 = FFT(LocalBuf(2048), in);\n shifted = PV_PhaseShift90(fft);\n Out.ar(out, [IFFT(fft2), IFFT(shifted)]);\n}.scope\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `PV_RectComb`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `PackFFT` and actually plays. Assume nothing about the session."}, {"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": "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 `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": "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 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 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 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 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 `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 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 `PulseCount`: bind everything it needs first."}, {"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 `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 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": "Write a complete SuperCollider patch built around `QuadC` that runs as it is."}, {"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 complete SuperCollider patch built around `QuadL` that runs as it is."}, {"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 SuperCollider patch that uses `QuadN` and actually plays. Assume nothing about the session."}, {"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": "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": "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": "Show me a self-contained SuperCollider patch using `Recorder`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `RunningSum` and actually plays. Assume nothing about the session."}, {"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": "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 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 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": "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 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 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 self-contained SuperCollider patch that uses `SpecCentroid`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, 2048, 1);\n(\nx = {\n var in, chain, freq, rq, centroid;\n\n // freq = LFPar.kr(0.3).exprange(100, 1000);\n freq = MouseY.kr(1000, 100, 1);\n in = Blip.ar(freq, MouseX.kr(1, 100, 1));\n chain = FFT(LocalBuf(2048), in);\n centroid = SpecCentroid.kr(chain);\n centroid.poll(10);\n in.dup * 0.1\n\n}.play\n);\n\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SpecFlatness` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ // Example - vary mixture of white noise and pure tone with the mouse\n var in, chain, flat, flatdb, flatdbsquish;\n\n in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1, 1));\n chain = FFT(LocalBuf(2048), in);\n Out.ar(0, in * 0.1);\n\n flat = SpecFlatness.kr(chain);\n\n flatdb = 10 * flat.log; // Convert to decibels\n flatdbsquish = LinLin.kr(flatdb, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.\n\n flat.poll(10, \"flatness: \");\n flatdb.poll(10, \"flatness (db): \");\n\n [flat, flatdbsquish]\n}.scope;\n);\n\n(\n{ // Now try with your own voice\n var in, chain;\n in = SoundIn.ar([0, 1]).mean;\n chain = FFT(LocalBuf(2048), in);\n Out.kr(0, [in, SpecFlatness.kr(chain).poll(1, \"flatness: \")]);\n}.scope;\n)\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": "Write a complete SuperCollider patch built around `TChoose` that runs as it is."}, {"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 complete SuperCollider patch built around `TIRand` that runs as it is."}, {"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": "Write a SuperCollider patch that uses `TWChoose` and actually plays. Assume nothing about the session."}, {"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": "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": "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 `Unpack1FFT`: bind everything it needs first."}, {"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 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": "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 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 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": "Write a SuperCollider patch that uses `WhiteNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), in); // encode to frequency domain\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4)); // process\n IFFT(chain) // decode to time domain\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Ringz` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = Ringz.ar(Impulse.ar([2, 3]), [700, 800], 0.1) * 5; // stereo input\n chain = FFT({ LocalBuf(2048) } ! 2, in); // array of two local buffers\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4));\n IFFT(chain) // returns a stereo out\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFClipNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { var inA, chainA, chainB;\n inA = LFClipNoise.ar(100);\n chainA = FFT(LocalBuf(2048, 1), inA);\n chainB = PV_PhaseShift(chainA, pi);\n // half-circle phase shift should result in an inverse signal\n // in practice, ultra-low frequencies sneak through\n // but you won't hear very much here\n IFFT(chainA) + IFFT(chainB);\n}.play;\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": "Write a self-contained SuperCollider patch that uses `Ringz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nx = { arg freq=1000; Ringz.ar(Crackle.ar(1.95, 0.1), freq, 0.05) }.play(s);\nx.set(\\freq, 1500);\nx.free;\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 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 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": "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": "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 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 complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// define a control\nSynthDef(\"line\", { arg i_bus=10, i_start=1000, i_end=500, i_time=1;\n ReplaceOut.kr(i_bus, Line.kr(i_start, i_end, i_time, doneAction: Done.freeSelf));\n}).add\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": "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 `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 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": "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": "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 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 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": "Give me a complete SuperCollider patch for (thor magnusson) (2006) An instrumentalist inside a synthdef: bind everything it needs before it is used."}, {"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": "Write a SuperCollider patch for shepard tones alberto de campo that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// shepard tones\n// alberto de campo\n(\nvar ampTable, freqTable, b1, b2;\n\nampTable = Signal.hanningWindow(1024).squared;\nfreqTable = Signal.newClear(1024).waveFill({ arg i; 0.5 ** i * 20000 }, 0, 10);\n\nb1 = Buffer.loadCollection(s, freqTable);\nb2 = Buffer.loadCollection(s, ampTable);\n\n{\n var freqs, amps, phasor, ratescale, rate, phases;\n ratescale = 1024 / 44100 / 10;\n rate = 0.1; // once per 10 sec\n phasor = Phasor.ar(0, rate * ratescale, 0, 1024);\n phases = (0..9) * 0.1 * 1024 + phasor;\n\n freqs = BufRd.ar(1, b1.bufnum, phases);\n amps = BufRd.ar(1, b2.bufnum, phases);\n\n Mix.ar(SinOsc.ar(freqs) * amps) * 0.1;\n}.play;\n\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": "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": "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 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 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 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// 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": "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": "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// 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 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": "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": "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": "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": "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 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 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 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": "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": "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// =========================\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 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 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": "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 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": "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": "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 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 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": "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 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 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 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": "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": "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": "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": "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": "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 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": "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 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 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": "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 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 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": "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 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": "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 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": "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": "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 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(\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 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{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 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\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~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 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 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": "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 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 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 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 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 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": "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 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": "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 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 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 your name?"}, {"role": "assistant", "content": "sc-mind. I am the 198M MiniMind-3-MoE this repository trains on SuperCollider source and help text."}]} {"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M-parameter MiniMind-3-MoE with 64M active per token: 768 wide, 8 layers, four experts with top-1 routing, a 6,400-token vocabulary, trained from scratch on SuperCollider."}]} {"conversations": [{"role": "user", "content": "Are you ChatGPT?"}, {"role": "assistant", "content": "No. I am sc-mind, a 198M SuperCollider model trained from scratch on the language's own source and documentation. I am not a general assistant and I do not have a general model behind me."}]} {"conversations": [{"role": "user", "content": "Are you a general assistant?"}, {"role": "assistant", "content": "No. I am sc-mind, a 198M model trained on SuperCollider. Ask me about SynthDefs, UGens, Patterns, Ndef, sclang and scsynth; outside that I have little to offer."}]} {"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I am sc-mind, trained by this repository from a six-source SuperCollider corpus and a supervised set whose code answers were compiled with sclang before they were written."}]} {"conversations": [{"role": "user", "content": "What can you help with?"}, {"role": "assistant", "content": "SuperCollider. I can write a SynthDef or a Pbind, explain a class or a UGen, read a patch back, and diagnose one that fails to compile. That is the whole of my training."}]} {"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198.42M parameters in total, 63.94M active per token. Eight layers, 768 wide, four experts with top-1 routing, and a 6,400-token vocabulary."}]} {"conversations": [{"role": "user", "content": "What were you trained on?"}, {"role": "assistant", "content": "The official SuperCollider tree, 321 Quarks, sccode.org, scsynth.org, sc3-plugins and this project's own sessions: 25.8M tokens, then 6,000 supervised rows whose code answers all compile."}]} {"conversations": [{"role": "user", "content": "Do you know other programming languages?"}, {"role": "assistant", "content": "Only as far as SuperCollider needs them. I am sc-mind, a 198M model trained on SuperCollider; I can read its sclang syntax and explain it, and that is the limit of what I was trained to do."}]} {"conversations": [{"role": "user", "content": "What should I ask you?"}, {"role": "assistant", "content": "SuperCollider questions: how a UGen works, how to write a SynthDef or a Pattern, why a patch does not compile. I am sc-mind, a 198M domain model, not a general assistant."}]} {"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 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": "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 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 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 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 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": "Why does everyone wrap code in s.waitForBoot?"}, {"role": "assistant", "content": "Because the server boots asynchronously, and a SynthDef added before it is up never reaches it. `s.waitForBoot { ... }` runs the block once the server has finished booting; inside a Routine you can also use `s.boot; s.sync;` for the same effect. If you see 'SynthDef not found' on code that clearly looks right, this is usually why."}]} {"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 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 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": "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 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 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": "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 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 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 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 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 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 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 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": "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 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 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 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 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 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": "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 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 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": "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": "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": "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": "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": "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": "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": "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": "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": "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": "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": "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 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": "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\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 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 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 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": "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 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": "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 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": "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": "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": "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": "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": "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 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": "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": "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(\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 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 `EaseOutQuart` in SuperCollider?"}, {"role": "assistant", "content": "EaseOutQuart — Quartic ease-out Easing equation for a quartic (t^4) ease-out, decelerating to zero velocity. Category: Ease."}]} {"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\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": "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": "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": "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": "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 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 `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 `MxCable.freeToBundle` do? What arguments does it take?"}, {"role": "assistant", "content": "Free any resources. In practice everything is freed at stop and no resources are kept Arguments: bundle. Returns: this"}]} {"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": "Write a SuperCollider patch for 8-bit synth (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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": "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 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 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": "What does `Pset.new` do? What arguments does it take?"}, {"role": "assistant", "content": "event pattern that sets values of one key 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": "How do I granulate a sample with 0.15 s grains? (rate 28, dur 0.15, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.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// 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 `Dust2` that runs as it is."}, {"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": "Write a kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `RedHuffman.bytesToBinaryString` do?"}, {"role": "assistant", "content": "Converts an array of 8-bit bytes into a binary"}]} {"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": "Write a SuperCollider patch for We all could use a little more that runs as it is, with nothing assumed about the session."}, {"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": "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": "How do I granulate a sample with 0.2 s grains? (rate 16, dur 0.2, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "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": "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 `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 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": "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 `Fb1_Duffing.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new Fb1_Duffing kr Arguments: f — Defaults to 0.; alpha — Defaults to 0.; beta — Defaults to 1.; gamma — Defaults to 1.; delta — Defaults to 1.; omega — Defaults to 1.; 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 / control duration. For getting audible oscillations you might, depending on the ODE definition, have to pass much higher values. Can also be a kr UGen and m; t0 — Initial time. Expects Number. Defaults to 0.."}]} {"conversations": [{"role": "user", "content": "Add freeverb to a pluck patch at room 0.85. (verb freeverb, room 0.85, damp 0.5, mix 0.3, source pluck)"}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: freeverb on a pluck\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.003, 0.5, 1, -4), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.3, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `CutFXSwap1` in SuperCollider?"}, {"role": "assistant", "content": "CutFXSwap1 — adds and removes random effects in a BBCut2 CutFXSwap1 randomly adds and removes instances of CutBRF1, CutBPF1, CutMod1, CutBit1, CutComb1, CutRev1 to the CutGroup it is in. Every second block in each phrase, CutFXSwap1 may remove and may add one of these. Category: Libraries > BBCut > Cut FX."}]} {"conversations": [{"role": "user", "content": "What does `List.fill` do?"}, {"role": "assistant", "content": "Inserts the item into the contents of the receiver, possibly returning a new collection. the difference between this and Collection#*fill#Collection's *fill."}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Dwhite`. Define every value it uses."}, {"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 does `U.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": "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 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": "Write a SuperCollider patch that uses `Dust` and actually plays. Assume nothing about the session."}, {"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 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\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": "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(\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 is `HLayoutView` in SuperCollider?"}, {"role": "assistant", "content": "HLayoutView — A container view that arranges its children horizontally Category: GUI > Views."}]} {"conversations": [{"role": "user", "content": "Explain `ControlFile` in SuperCollider briefly."}, {"role": "assistant", "content": "ControlFile — Write specs into File A tool for reading and writing spec files. Category: Libraries > Radicles."}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens sine, cutoff 2400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_165_2400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a pluck with damping 0.2 on the reverb."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb2 on a pluck\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.003, 0.5, 1, -4), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.5, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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 `AbstractPlayerGui.synthConsole` do? What arguments does it take?"}, {"role": "assistant", "content": "standard play/record/etc. controls using SynthConsole. you can override this method in subclasses to Arguments: layout."}]} {"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": "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 `AudioInPlayer.storeArgs` do?"}, {"role": "assistant", "content": "plays the computers audio in — microphone or record busses"}]} {"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 `SynthDesc.outputs` do?"}, {"role": "assistant", "content": "Description of a synth definition Returns: an array of IODesc that describes the available outputs."}]} {"conversations": [{"role": "user", "content": "Add freeverb2 to a bell patch at room 0.5."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.3, 0.5, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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// 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": "What is `Rest` in SuperCollider?"}, {"role": "assistant", "content": "Rest — Represents a rest in event patterns A Rest may be used in event patterns to indicate that the resulting event should be a rest (i.e., silent). It should be used in one of the child patterns belonging to a Pbind, for instance. Category: Streams-Patterns-Events."}]} {"conversations": [{"role": "user", "content": "What does `IBVA.dnAction` do?"}, {"role": "assistant", "content": "a Function that is evaluated when a reply from a #-getDeviceName method is called (callback). the argument passed in is a String. by default this function is set to just post the"}]} {"conversations": [{"role": "user", "content": "What is `FoaFocusY` in SuperCollider?"}, {"role": "assistant", "content": "FoaFocusY — First Order Ambisonic (FOA) focus transformer Apply focus to a First Order Ambisonic signal (B-format) along the y-axis. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} {"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": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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 kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `RedEffectsRack` in SuperCollider?"}, {"role": "assistant", "content": "RedEffectsRack — allround effects rack for RedEffectModule A class for grouping RedEffectModules. Category: Red > redEffectsRack."}]} {"conversations": [{"role": "user", "content": "What is `AmpComp` in SuperCollider?"}, {"role": "assistant", "content": "AmpComp — Basic psychoacoustic amplitude compensation. Implements the (optimized) formula: Category: UGens > Analysis > Amplitude."}]} {"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 `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": "Write a complete SuperCollider patch built around `LastValue` that runs as it is."}, {"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": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_165_1400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 800, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_110_800, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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": "Give me a Pbind with sine voices and a 0.4 rhythm."}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\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 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 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 `ArrayBuffer` in SuperCollider briefly."}, {"role": "assistant", "content": "ArrayBuffer — given an array, will allocate and fill a Buffer for use in Patch etc Passes an array into a Patch for use in UGens which need an array supplied as a buffer index. If saved as a compile string to disk, saves the array with it. Category: Libraries > crucial > Buffers."}]} {"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 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": "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 `Knob.decrement` do? What arguments does it take?"}, {"role": "assistant", "content": "Decrements the value by #-keystep multiplied by the Arguments: zoom — A Number.."}]} {"conversations": [{"role": "user", "content": "What does `LatoocarfianL.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."}]} {"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 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 `Routine` in SuperCollider?"}, {"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": "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": "Write an Ndef at 165 Hz I can retune while it plays. (ugens blip, cutoff 3200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_165_3200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `FPSignal.enDebug` do?"}, {"role": "assistant", "content": "Post incoming values to the post window with"}]} {"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 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": "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": "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": "Give me a kick with damping 0.2 on the reverb."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.5, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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 is `Mix` in SuperCollider?"}, {"role": "assistant", "content": "Mix — Sum an array of channels. Mix will mix an array of channels down to a single channel or an array of arrays of channels down to a single array of channels. More information can be found under Multichannel-Expansion. Category: UGens > Multichannel."}]} {"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 `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": "Write a complete SuperCollider patch built around `MultiTap` that runs as it is."}, {"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 is `FFT` in SuperCollider?"}, {"role": "assistant", "content": "FFT — Fast Fourier Transform The fast fourier transform analyzes the frequency content of a signal, which can be useful for audio analysis or for frequency-domain sound processing (phase vocoder). Category: UGens > FFT."}]} {"conversations": [{"role": "user", "content": "Write a bell whose tail uses freeverb."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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\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": "Explain `Latoocarfian2DC` in SuperCollider briefly."}, {"role": "assistant", "content": "Latoocarfian2DC — 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// 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": "Give me a granular patch with noise1 grain position and interp 4. (rate 6, dur 0.15, interp 4, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `Ringz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nx = { arg freq=1000; Ringz.ar(Crackle.ar(1.95, 0.1), freq, 0.05) }.play(s);\nx.set(\\freq, 1500);\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz? (ugens saw, cutoff 800, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_55_800, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M-parameter MiniMind-3-MoE with 64M active per token: 768 wide, 8 layers, four experts with top-1 routing, a 6,400-token vocabulary, trained from scratch on SuperCollider."}]} {"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": "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 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": "Write an Ndef with a saw source and a 200 Hz low-pass. (ugens saw, cutoff 200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\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": "Write a kick drum with a 0.12 s decay. (osc fm, sweep 0.06, decay 0.12, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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{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 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(\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": "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": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pshuf, dur 0.25, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `MIDIFuncBothMessageMatcher.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Make a new Arguments: chan — (describe argument here); srcID — The UID of the MIDI source source to test against as an Integer.; func — The Function to evaluate if a match is found.. Returns: An MIDIFuncBothMessageMatcher."}]} {"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 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 Generators > Deterministic."}]} {"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": "Explain `FoaNr` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaNr — First Order Ambisonic (FOA) Soundfield Unit Normalized Reactive Intensity Vector Return the Unit Normalized Reactive Intensity Vector, Nr, 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 `PlayerSocket.lastPlayer` 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// 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": "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 self-contained SuperCollider patch that uses `NodeControl`. Define every value it uses."}, {"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 `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": "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 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": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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": "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\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": "Give me a bell with damping 0.2 on the reverb."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: freeverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.7, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"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\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 `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 `MxUnitApp.>>` do? What arguments does it take?"}, {"role": "assistant", "content": "Connect the default out of this unit to \"that\". `u >> Arguments: that — an inlet, a channel fader."}]} {"conversations": [{"role": "user", "content": "What does `Slider2D.pixelStepY` do?"}, {"role": "assistant", "content": "The absolute amount by which #-y would change if the handle moved vertically by one Returns: A Float."}]} {"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 `SimpleController.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a SimpleController instance with the model to be Arguments: model — An object of any class."}]} {"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 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": "Write a complete SuperCollider patch built around `DigitalIO` that runs as it is."}, {"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": "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": "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": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_165_1400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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": "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": "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 kick whose tail uses freeverb2. (verb freeverb2, room 0.7, damp 0.2, mix 0.45, source kick)"}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: freeverb2 on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.7, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.4, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `GrainIn` in SuperCollider?"}, {"role": "assistant", "content": "GrainIn — Granulate an input signal Category: UGens > Generators > Granular."}]} {"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 `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": "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": "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": "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 `MIDIOut.findPort` do?"}, {"role": "assistant", "content": "Searches for a connected MIDIEndPoint by name. `// list connected out ports with"}]} {"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 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": "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": "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 is `PLshuf` in SuperCollider?"}, {"role": "assistant", "content": "PLshuf — dynamic scope Pshuf variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. A PLshuf stream keeps a permutation until it ends or there is a list replacement. See PLshufn for ongoing choice of new permutations. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} {"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": "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// 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": "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 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 `TrigAvg` in SuperCollider?"}, {"role": "assistant", "content": "TrigAvg — triggered signal averager Averages the absolute values of its input between triggers. Category: UGens > Analysis, UGens > Maths."}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Prand, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\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{ 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 `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 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 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": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.1, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\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": "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{ 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// 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": "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": "Give me a granular patch with sweep grain position and interp 4. (rate 16, dur 0.04, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "What does `ObjectNotFound.somethingMissing` do?"}, {"role": "assistant", "content": "an placeholder object for when a player was not found when loading was attempted due to it being referenced by path from within another player"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SpecFlatness` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ // Example - vary mixture of white noise and pure tone with the mouse\n var in, chain, flat, flatdb, flatdbsquish;\n\n in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1, 1));\n chain = FFT(LocalBuf(2048), in);\n Out.ar(0, in * 0.1);\n\n flat = SpecFlatness.kr(chain);\n\n flatdb = 10 * flat.log; // Convert to decibels\n flatdbsquish = LinLin.kr(flatdb, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.\n\n flat.poll(10, \"flatness: \");\n flatdb.poll(10, \"flatness (db): \");\n\n [flat, flatdbsquish]\n}.scope;\n);\n\n(\n{ // Now try with your own voice\n var in, chain;\n in = SoundIn.ar([0, 1]).mean;\n chain = FFT(LocalBuf(2048), in);\n Out.kr(0, [in, SpecFlatness.kr(chain).poll(1, \"flatness: \")]);\n}.scope;\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{ 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": "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 `Pdef.fadeTime` do?"}, {"role": "assistant", "content": "When the synthdefs that are used contain an `\\amp` control, the patterns are replaced by crossfading the previous with the new over this time (in"}]} {"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": "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": "How do I granulate a sample with 0.04 s grains? (rate 14, dur 0.04, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Pstutter.new` do? What arguments does it take?"}, {"role": "assistant", "content": "repeat input stream values Arguments: n — The number of repeats for each new element. n may be a pattern, so the number of times can vary each iteration.; pattern — the pattern to repeat.. Returns: Pdup"}]} {"conversations": [{"role": "user", "content": "What can you help with?"}, {"role": "assistant", "content": "SuperCollider. I can write a SynthDef or a Pbind, explain a class or a UGen, read a patch back, and diagnose one that fails to compile. That is the whole of my training."}]} {"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 `RedWorld.objects` do?"}, {"role": "assistant", "content": "An Array of all objects currently in this"}]} {"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": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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, 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": "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": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `TraerAttraction.getMinimumDistance` do?"}, {"role": "assistant", "content": "Get the minimum distance, which limits how strong the force can get close Returns: a LINKClasses/Float"}]} {"conversations": [{"role": "user", "content": "What does `MxDocument.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a wrapper for placing code Documents onto the Mx grid Arguments: path; content."}]} {"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": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `Int32Array` in SuperCollider briefly."}, {"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// 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 `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 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": "Explain `Integrator` in SuperCollider briefly."}, {"role": "assistant", "content": "Integrator — A leaky integrator. Integrates an input signal with a leak. The formula implemented is: Category: UGens > Filters > Linear, UGens > Maths."}]} {"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": "What is `File` in SuperCollider?"}, {"role": "assistant", "content": "File — A class for reading and writing files A class for reading and writing files. Not sound files. Category: Files."}]} {"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 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": "Write a SuperCollider patch that uses `LFClipNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { var inA, chainA, chainB;\n inA = LFClipNoise.ar(100);\n chainA = FFT(LocalBuf(2048, 1), inA);\n chainB = PV_PhaseShift(chainA, pi);\n // half-circle phase shift should result in an inverse signal\n // in practice, ultra-low frequencies sneak through\n // but you won't hear very much here\n IFFT(chainA) + IFFT(chainB);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `MultiLevelIdentityDictionary.removeEmptyAt` do?"}, {"role": "assistant", "content": "Remove the item located by the path. This might make the item's parent dictionary empty. In that case, it will remove the parent and continue up the chain, removing empty dictionaries as it goes. This is slower but"}]} {"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 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": "How do I play a random majorPentatonic scale at octave 5? (scale majorPentatonic, seq Pseq, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\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": "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 `Instr.plot` do? What arguments does it take?"}, {"role": "assistant", "content": "creates a Patch and plays it for {duration} seconds and plots Arguments: args — array or dict; duration."}]} {"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// 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 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": "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 `JITGui.csView` do?"}, {"role": "assistant", "content": "(specific in the JITGui class) displays the object's"}]} {"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": "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 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": "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 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 `ProxySpace` in SuperCollider?"}, {"role": "assistant", "content": "ProxySpace — an environment of references on a server Generally a proxy is a placeholder for something. A node proxy is a placeholder for something playing on a server that writes to a limited number of busses (e.g. a synth or an event stream). NodeProxy objects can be replaced and recombined while they play. Also they can be used to build a larger structure which is used and modified later on. Overview: JITLib Category: JITLib > Environments, Live Coding, Collections > Unordered."}]} {"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": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 800, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 3200 Hz low-pass. (ugens sine, cutoff 3200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_55_3200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).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 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 `StaticText.background` do? What arguments does it take?"}, {"role": "assistant", "content": "Setting this variable colors the whole area occupied by the view under the text with the given Arguments: A Color.."}]} {"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\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": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Prand, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Will nobody switch the damn thing off?: bind everything it needs before it is used."}, {"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{ 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 kick drum with a 0.25 s decay. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\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 `Integer.grayCode` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: the gray code for the number."}]} {"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(\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 `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 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 `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": "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 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": "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 complete SuperCollider patch built around `IFFT` that runs as it is."}, {"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": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for it goes beyond vibrato too. Define every value it uses."}, {"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": "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": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 400, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_110_400, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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": "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 `DoubleNestedAllpassN` in SuperCollider briefly."}, {"role": "assistant", "content": "DoubleNestedAllpassN — Nested Allpass filters as proposed by Vercoe and Pluckett Useful for reverberation, especially implementing Gardner reverbs. Category: UGens > Delays."}]} {"conversations": [{"role": "user", "content": "Are you a general assistant?"}, {"role": "assistant", "content": "No. I am sc-mind, a 198M model trained on SuperCollider. Ask me about SynthDefs, UGens, Patterns, Ndef, sclang and scsynth; outside that I have little to offer."}]} {"conversations": [{"role": "user", "content": "What is `FoaPanB` in SuperCollider?"}, {"role": "assistant", "content": "FoaPanB — First Order Ambisonic (FOA) panner Encode a monophonic input to a First Order Ambisonic signal (B-format), as a planewave. PanB is the SuperCollider inbuilt equivalent. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Encoder, UGens > Multichannel > Ambisonics, UGens > Multichannel > Panners."}]} {"conversations": [{"role": "user", "content": "Explain `Blip` in SuperCollider briefly."}, {"role": "assistant", "content": "Blip — Band limited impulse oscillator. Band Limited ImPulse generator. All harmonics have equal amplitude. This is the equivalent of 'buzz' in MusicN languages. Category: UGens > Generators > Deterministic."}]} {"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": "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 `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 `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 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(\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": "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 `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 kick drum with a 0.35 s decay. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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 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 GrainBuf synth at 20 grains per second. (rate 20, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "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 `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 `Layout.margins` do? What arguments does it take?"}, {"role": "assistant", "content": "The amount of empty pixels left between the edges of the parent view and the managed Arguments: margins — An array of four integers defining margins in the following order: left margin, top margin, right margin, bottom margin; or an array of two integers applied to left/right margin and top/bottom margin respectively; or a single integer applied to all margins.."}]} {"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": "Write a kick at amp 0.6 with no click. (osc saw, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\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": "Explain `RandID` in SuperCollider briefly."}, {"role": "assistant", "content": "RandID — Set the synth's random generator ID. Choose which random number generator to use for this synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again. Category: UGens > Generators > Stochastic, UGens > Random."}]} {"conversations": [{"role": "user", "content": "What does `U.synths` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: synths — (describe argument here). Returns: (returnvalue)"}]} {"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 `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 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 `PackFFT` and actually plays. Assume nothing about the session."}, {"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": "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 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 for outer beat. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```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```"}]} {"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": "Write a complete SuperCollider patch built around `QuadC` that runs as it is."}, {"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 an Ndef at 55 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_55_2400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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 = { |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 `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": "How do I granulate a sample with 0.1 s grains? (rate 6, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `Peak` in SuperCollider briefly."}, {"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 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": "Explain `RedBMP` in SuperCollider briefly."}, {"role": "assistant", "content": "RedBMP — bitmap images Read and write .bmp files from disk. Handles 1, 4, 8, 16, 24 and 32bit depths. Includes simple #-makeWindow and #-plot methods to display the pixels (but you should really write your own). Category: Red > redTools."}]} {"conversations": [{"role": "user", "content": "What is `MemoRoutine` in SuperCollider?"}, {"role": "assistant", "content": "MemoRoutine — Routine-like object which stores last values A MemoRoutine behaves like a Routine, though it is not defined as a subclass of it. It stores last values, the maximum buffer size can be defined. MemoRoutine is internally used by PSx and related Pattern classes, which therefore also remember their last value(s). Category: Libraries > miSCellaneous > PSx stream patterns, Streams-Patterns-Events > PSx stream patterns."}]} {"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": "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": "Write a SuperCollider patch that uses `TWChoose` and actually plays. Assume nothing about the session."}, {"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": "How do I make a kick that starts at 180 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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, 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 is `IODesc` in SuperCollider?"}, {"role": "assistant", "content": "IODesc — Description of SynthDesc input or output IODesc describes an input or output of a SynthDesc, as returned by SynthDesc#-outputs and SynthDesc#-inputs Category: Server > Nodes."}]} {"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 `EaseOutInElastic` in SuperCollider?"}, {"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": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc fm, sweep 0.06, decay 0.18, f0 220, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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": "Give me an Ndef with an LFO at 0.1 Hz. (ugens saw, cutoff 1400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_110_1400, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 110 Hz? (ugens saw, cutoff 3200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_110_3200, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `FoaXform` in SuperCollider?"}, {"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": "Explain `MIDIFunc` in SuperCollider briefly."}, {"role": "assistant", "content": "MIDIFunc — Fast Responder for incoming MIDI Messages MIDIFunc (and its subclass MIDIdef) registers one or more functions to respond to an incoming MIDI message. Many of its methods are inherited from its superclass AbstractResponderFunc. Category: External Control > MIDI."}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.2, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Color.subtract` 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\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": "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 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\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": "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\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": "Write a kick drum with a 0.5 s decay. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\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 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": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pwalk, dur 0.2, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a complete SuperCollider patch for Nested ifs in a SynthDef: bind everything it needs before it is used."}, {"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": "How do I build a live drone with Ndef at 220 Hz? (ugens saw, cutoff 800, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_220_800, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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 `IntegerEditor.value` do? What arguments does it take?"}, {"role": "assistant", "content": "a number box and slider for editing an Integer value Arguments: val; changer."}]} {"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 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": "Write a pluck whose tail uses gverb. (verb gverb, room 0.5, damp 0.5, mix 0.45, source pluck)"}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: gverb on a pluck\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.003, 0.5, 1, -4), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n var wet = GVerb.ar(sig, 40.0, 3, 0.5, 0.5, 15, 0.4, 0.3, 0.45);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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 `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": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale majorPentatonic, seq Prand, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a sine source and a 800 Hz low-pass. (ugens sine, cutoff 800, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_220_800, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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{ 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": "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 `SetResetFF` in SuperCollider?"}, {"role": "assistant", "content": "SetResetFF — Set-reset flip flop. Output is set to 1.0 upon receiving a trigger in the trig input, and to 0.0 upon receiving a trigger in the reset input. Once the flip flop is set to zero or one further triggers in the same input are have no effect. One use of this is to have some precipitating event cause something to happen until you reset it. Category: UGens > Triggers."}]} {"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 `List.pyramid` do?"}, {"role": "assistant", "content": "Return a new List whose elements have been reordered via one of 10 \"counting\" algorithms. The algorithms are numbered 1 through 10. Run the examples to see the algorithms. `List[1, 2, 3,"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Dseries` and actually plays. Assume nothing about the session."}, {"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 `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 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 `NamedIntegersSpec.canKr` do?"}, {"role": "assistant", "content": "datatype specifying an option list with names and an integer output type"}]} {"conversations": [{"role": "user", "content": "What does `Object.!?` do?"}, {"role": "assistant", "content": "If the receiver is not nil, evaluate the Function passing in the receiver as argument and return the result, otherwise return"}]} {"conversations": [{"role": "user", "content": "What does `FoaXformerMatrix.newPushY` do? What arguments does it take?"}, {"role": "assistant", "content": "Apply push along the Arguments: angle — The distortion angle, in radians. -pi/2 to pi/2."}]} {"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 `KeyCodeResponder` in SuperCollider?"}, {"role": "assistant", "content": "KeyCodeResponder — register responder functions for keycode and modifier combinations Handles multiple registrations for keycode and modifier combinations. This object should be used as the keydown or keyup action for a view in place of a function. Category: Libraries > crucial > Keyboard, External Control > Keyboard."}]} {"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 `Semaphore.clear` do?"}, {"role": "assistant", "content": "Remove any reference to threads, but do not reschedule any pending"}]} {"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 `SoundFileFormats.sampleFormat` do?"}, {"role": "assistant", "content": "a widget for selecting SoundFile format for recording"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.35 s decay. (osc fm, sweep 0.06, decay 0.35, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"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": "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 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 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 `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 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 an Ndef at 82.5 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens saw, cutoff 400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_165_400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `SGliss.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.."}]} {"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 does `File.delete` do?"}, {"role": "assistant", "content": "Deletes the file at that path. Use only for good, never for Returns: a Boolean, as follows:"}]} {"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 `View.minHeight` do? What arguments does it take?"}, {"role": "assistant", "content": "Set minimum allowed height of the view, the view will not be able to shrink smaller in height, neither by user interaction nor Arguments: height — An Int.."}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.04 s grains? (rate 10, dur 0.04, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `ObjectGui.writeName` do? What arguments does it take?"}, {"role": "assistant", "content": "ObjectGui by default makes a nameplate with the name of the model. Implement this in subclasses if a different name style or no nameplate is desired. Note: this may change in the near future. So many classes override this to shut off the Arguments: layout — The layout to place the nameplate on. Probably the same as is being passed to guiBody."}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Swarm of sound files. Define every value it uses."}, {"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": "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": "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": "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 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\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{ 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 were you trained on?"}, {"role": "assistant", "content": "The official SuperCollider tree, 321 Quarks, sccode.org, scsynth.org, sc3-plugins and this project's own sessions: 25.8M tokens, then 6,000 supervised rows whose code answers all compile."}]} {"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": "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": "How do I make a kick that starts at 220 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Electrode Theremin (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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": "Add gverb to a pluck patch at room 0.5."}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: gverb on a pluck\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.003, 0.5, 1, -4), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n var wet = GVerb.ar(sig, 40.0, 3, 0.2, 0.5, 15, 0.4, 0.3, 0.3);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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": "Write a Pbind whose degrees repeat every Pseq cycle. (scale minorPentatonic, seq Pseq, dur 0.3, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\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\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 `KeyResponder.++` do? What arguments does it take?"}, {"role": "assistant", "content": "combines KeyCodeResponder and UnicodeResponder Arguments: that."}]} {"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": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 800, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_55_800, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Mix.fill` do? What arguments does it take?"}, {"role": "assistant", "content": "Sum an array of channels. Arguments: n — The size of array to create.; function — The array filling function.. Returns: Returns: A newly created"}]} {"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\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": "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\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": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `PLFClipNoise.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": "Write a SuperCollider patch that uses `QuadN` and actually plays. Assume nothing about the session."}, {"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 granular texture, through a reverb. (rate 14, dur 0.15, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "Explain `Tempo` in SuperCollider briefly."}, {"role": "assistant", "content": "Tempo — for control of tempo and for use in tempo based calculations This class represents the concept of tempo. It can be used for translations between seconds, beats and bars. It holds an instance of TempoClock which it keeps set to its own tempo. Category: Libraries > crucial > Scheduling."}]} {"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": "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\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 `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 `LID.initializeLID` do?"}, {"role": "assistant", "content": "Initialize the LID subsystem, this method is called automatically when calling the method"}]} {"conversations": [{"role": "user", "content": "What is `PLbindefPar` in SuperCollider?"}, {"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": "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": "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 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": "How do I make a kick that starts at 180 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.25, f0 180, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `PInRect.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern — pattern x-position; y — pattern y-position; rect — a Rect object.."}]} {"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": "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 `UScore.updatePos` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: x — (describe argument here). Returns: (returnvalue)"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise1 grain position and interp 2."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `OscN` in SuperCollider?"}, {"role": "assistant", "content": "OscN — Noninterpolating wavetable oscillator. Noninterpolating wavetable lookup oscillator with frequency and phase modulation inputs. It is usually better to use the interpolating oscillator Osc . Category: UGens > Generators > Deterministic."}]} {"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 does `SimpleNumber.heumanLambda` do?"}, {"role": "assistant", "content": "Returns the result of the Heuman Lambda 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{ 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": "Give me an Ndef with an LFO at 0.8 Hz. (ugens tri, cutoff 2400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_220_2400, { |freq = 220, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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// 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": "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 is `PDelayN` in SuperCollider?"}, {"role": "assistant", "content": "PDelayN — UGenPatterns quark library Based on DelayN Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} {"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": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Prand, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `ControlName`. Define every value it uses."}, {"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": "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 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": "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": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\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 does `GridLayout.hSpacing` do?"}, {"role": "assistant", "content": "The spacing between columns, in Integer amount of"}]} {"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": "Write an Ndef with a blip source and a 1400 Hz low-pass. (ugens blip, cutoff 1400, lfo 0.8, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_220_1400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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": "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": "Write a self-contained SuperCollider patch that uses `Dseq`. Define every value it uses."}, {"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 SuperCollider patch for Feedback resonator. Start by defining the values the patch depends on."}, {"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 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": "Write an Ndef with a sine source and a 3200 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_220_3200, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `SClusterFrequencies` in SuperCollider?"}, {"role": "assistant", "content": "SClusterFrequencies — control SCluster frequencies Frequency control for LINKClasses/SCluster. Category: SInstruments."}]} {"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\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 does `Interface.onPrepareToBundle` 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 kick drum with a 0.5 s decay. (osc saw, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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// 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\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": "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//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 `UChain.gui` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a Arguments: parent — A view; bounds — A Rect. Returns: UChaiGUI"}]} {"conversations": [{"role": "user", "content": "Give me a kick with damping 0.5 on the reverb. (verb gverb, room 0.5, damp 0.5, mix 0.45, source kick)"}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: gverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = GVerb.ar(sig, 40.0, 3, 0.5, 0.5, 15, 0.4, 0.3, 0.45);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `Red3D` in SuperCollider?"}, {"role": "assistant", "content": "Red3D — abstract 3D class An abstract class for 3D shape classes. Category: Red > redUniverse > shapes."}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `KeyTrack`: bind everything it needs first."}, {"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": "What does `Task.stop` do?"}, {"role": "assistant", "content": "Stop playing now. (Pause and stop have the same"}]} {"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(\nb = Buffer.alloc(s, 1);\n{\nvar x, y, rate, a, c, m;\n rate = MouseX.kr(100, SampleRate.ir);\n a = 1.1;\n c = 0.13;\n m = 1.0;\n x = Dbufrd(b); // read from buffer\n x = x * a + c % m;\n y = Dbufwr(x, b); // write to buffer\n Duty.ar(1 / rate, 0, y) * 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(\nb = Buffer.alloc(s, 1);\n{\nvar x, y, rate, a, c, m;\n rate = MouseX.kr(100, SampleRate.ir);\n a = 1.1;\n c = 0.13;\n m = 1.0;\n x = Dbufrd(b); // read from buffer\n x = x * a + c % m;\n y = Dbufwr(x, b); // write to buffer\n Duty.ar(1 / rate, 0, y) * 0.1;\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `RedEffectModuleGUI.close` do?"}, {"role": "assistant", "content": "Check if a window was created as parent and then closes"}]} {"conversations": [{"role": "user", "content": "Explain `NL` in SuperCollider briefly."}, {"role": "assistant", "content": "NL — Non Linear Filter Equation Represents the arbitrary non-linear filter difference equation in the time domain: Category: UGens > Filters //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} {"conversations": [{"role": "user", "content": "Add gverb to a pluck patch at room 0.7."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: gverb on a pluck\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.003, 0.5, 1, -4), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n var wet = GVerb.ar(sig, 56.0, 3, 0.2, 0.5, 15, 0.4, 0.3, 0.45);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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{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": "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(\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": "Write an Ndef with a sine source and a 2400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 2400 Hz low-pass\n(\nNdef(\\nd_sine_220_2400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 150 Hz and falls to 40 Hz? (osc sine, sweep 0.06, decay 0.12, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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 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// 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": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens blip, cutoff 800, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_82_800, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `ModDif.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Minimum difference of two values in modulo arithmetics Arguments: x — First input value; y — Second input value; mod — Modulo (maximum value, double of the maximal difference). `// different moduli`."}]} {"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 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": "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 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 play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Prand, dur 0.3, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\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// 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 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 `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 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": "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 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": "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 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 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 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": "How do I granulate a sample with 0.15 s grains? (rate 14, dur 0.15, interp 2, mode noise1, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `Psubdivide` in SuperCollider briefly."}, {"role": "assistant", "content": "Psubdivide — partition a value into n equal subdivisions A filter pattern designed for a stream of float durations. Category: Streams-Patterns-Events > Patterns > Repetition."}]} {"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": "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 `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": "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 `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(\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 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": "Show me a self-contained SuperCollider patch using `Drand`: bind everything it needs first."}, {"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 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 make a kick that starts at 150 Hz and falls to 48 Hz? (osc saw, sweep 0.06, decay 0.25, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"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": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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 Pbind in minorPentatonic using Pseq for the degrees. (scale minorPentatonic, seq Pseq, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\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": "Show me a self-contained SuperCollider patch using `Dstutter`: bind everything it needs first."}, {"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 `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": "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 build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 200, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_165_200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick whose tail uses freeverb2. (verb freeverb2, room 0.5, damp 0.5, mix 0.45, source kick)"}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb2 on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.5, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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": "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// 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": "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 `PPulseCount.new` do? What arguments does it take?"}, {"role": "assistant", "content": "UGenPatterns quark library Arguments: pattern; reset."}]} {"conversations": [{"role": "user", "content": "Explain `SynthDescLib` in SuperCollider briefly."}, {"role": "assistant", "content": "SynthDescLib — SynthDesc library See SynthDesc Category: Server > Nodes."}]} {"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 `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": "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 `Ringz` in SuperCollider?"}, {"role": "assistant", "content": "Ringz — Ringing filter. This is the same as Resonz, except that it is a constant skirt gain filter, meaning that the peak gain depends on the value of Q. Also, instead of the resonance parameter in Resonz, the bandwidth is specified in a 60dB ring decay time. One Ringz is equivalent to one component of the Category: UGens > Filters > Linear."}]} {"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 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 `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": "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": "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": "Add freeverb2 to a bell patch at room 0.7."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.3, 0.7, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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": "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": "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": "Give me a granular patch with sweep grain position and interp 4. (rate 6, dur 0.04, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `NLFiltL` in SuperCollider briefly."}, {"role": "assistant", "content": "NLFiltL — Non-linear Filter Implements the filter `Y{n} =a Y{n-1} + b Y{n-2} + d Y^2{n-l} + X{n} - c` described in Dobson and sigmoid clipping. This filter is inherently unstable, so pick some sane values and move slowly from there. Category: UGens > Filters."}]} {"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": "Write a Pbind whose degrees repeat every Pseq cycle. (scale majorPentatonic, seq Pseq, dur 0.2, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\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 does `View.isClosed` do?"}, {"role": "assistant", "content": "The basic visible element of GUI Returns: A Boolean stating whether the view has been destroyed."}]} {"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": "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": "Show me a self-contained SuperCollider patch using `Unpack1FFT`: bind everything it needs first."}, {"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 kick at amp 0.8 with no click. (osc saw, sweep 0.06, decay 0.25, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `AbstractSample` in SuperCollider?"}, {"role": "assistant", "content": "AbstractSample — base class for the BufferProxy and Sample classes Category: Libraries > crucial > Buffers > abstract."}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\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 `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": "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 `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 `PBPZ2` in SuperCollider?"}, {"role": "assistant", "content": "PBPZ2 — UGenPatterns quark library Based on BPZ2 Category: Streams-Patterns-Events > UGenPatterns > Modifiers."}]} {"conversations": [{"role": "user", "content": "What does `EventShortcuts.current` do?"}, {"role": "assistant", "content": "Returns the Symbol of the current shortcut"}]} {"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\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": "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": "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": "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 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// 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 = 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 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": "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": "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": "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 = Dbrown2(0, 15, 1, [1, 4], 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(\n{\n var a, freq, trig;\n a = Dbrown2(0, 15, 1, [1, 4], 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": "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": "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 `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": "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 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": "Write a self-contained SuperCollider patch that uses `Dgeom`. Define every value it uses."}, {"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": "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 `RedAgent.act` do?"}, {"role": "assistant", "content": "A Function. Called as the second thing in the agent's update"}]} {"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": "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 `LineLayout` in SuperCollider?"}, {"role": "assistant", "content": "LineLayout — Superclass of layouts that distribute views in a line This is an abstract superclass of HLayout and VLayout which distribute views in a horizontal or vertical line, respectively. Category: GUI > Layout."}]} {"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// 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": "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 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 is `Pexprand` in SuperCollider?"}, {"role": "assistant", "content": "Pexprand — random values that follow a Exponential Distribution Category: Streams-Patterns-Events > Patterns > Random."}]} {"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 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": "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": "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": "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 `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": "What does `File.seek` do?"}, {"role": "assistant", "content": "Moves the read/write pointer to a given location in the file, where offset is location given in bytes, and origin is the reference of the"}]} {"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": "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": "How do I make a kick that starts at 220 Hz and falls to 40 Hz? (osc saw, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `TdefAllGui` in SuperCollider briefly."}, {"role": "assistant", "content": "TdefAllGui — see all Tdefs and their state TdefAllGui uses TdefGui views to display all Tdefs, or a selection. Category: JITLib > GUI, Live Coding."}]} {"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": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pwalk, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\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": "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 `SmoothClipQ.kr` do? What arguments does it take?"}, {"role": "assistant", "content": "wave shaping / clipping pseudo ugen using parabolic segments Arguments: in — input signal.; lo — lower limit, defaults to -1.; hi — upper limit, defaults to 1.; amount — 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": "How do I put a bell in a reverb at mix 0.45?"}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.7, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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": "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 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 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 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": "What is `RadiansPerSample` in SuperCollider?"}, {"role": "assistant", "content": "RadiansPerSample — Number of radians per sample. Returns the number of radians per sample. Category: UGens > Info."}]} {"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 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 `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": "How do I granulate a sample with 0.1 s grains? (rate 10, dur 0.1, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "Give me a complete SuperCollider patch for (thor magnusson) (2006) An instrumentalist inside a synthdef: bind everything it needs before it is used."}, {"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": "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 `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\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 `View.mouseMove` do?"}, {"role": "assistant", "content": "Handles response to mouse pointer moving after a mouse button has been pressed on the view. Evaluates #-mouseMoveAction. See #Mouse actions for explanation of"}]} {"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": "What does `UGenInstr.argNames` do?"}, {"role": "assistant", "content": "converts a single UGen into an Instr eg. UGenInstr(RLPF)"}]} {"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": "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": "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 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": "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": "Explain `NLFiltC` in SuperCollider briefly."}, {"role": "assistant", "content": "NLFiltC — Non-linear Filter Implements the filter `Y{n} =a Y{n-1} + b Y{n-2} + d Y^2{n-l} + X{n} - c` described in Dobson and sigmoid clipping. This filter is inherently unstable, so pick some sane values and move slowly from there. Category: UGens > Filters."}]} {"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": "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": "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": "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": "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 `GrayNoise` and actually plays. Assume nothing about the session."}, {"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 `TIRand.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Triggered integer random number generator. Arguments: lo — Lower limit of the output range.; hi — Upper limit of the output range.; trig — The trigger. Trigger can be any signal. A trigger happens when the signal changes from non-positive to positive.."}]} {"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 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 `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": "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": "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": "How do I build a live drone with Ndef at 165 Hz? (ugens saw, cutoff 2400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_165_2400, { |freq = 165, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"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 `RedObject.contains` do?"}, {"role": "assistant", "content": "Returns true if two objects touch. See #-size"}]} {"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\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```"}, {"role": "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 = 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 does `String.warn` do?"}, {"role": "assistant", "content": "Prepends a warning banner and posts the string. `\"Do not press this button"}]} {"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 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// 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 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": "Give me a granular patch with noise grain position and interp 2. (rate 10, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.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{ 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": "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"}]} {"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": "Explain `Fb1_HopfA` in SuperCollider briefly."}, {"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": "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 kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 150, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `WhiteNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), in); // encode to frequency domain\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4)); // process\n IFFT(chain) // decode to time domain\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(\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": "Explain `TGrains2` in SuperCollider briefly."}, {"role": "assistant", "content": "TGrains2 — buffer granulator with linear att/dec Triggers generate grains from a buffer. Each grain has a linear and is panned between two channels of multiple outputs. Category: UGens > Buffer, UGens > Generators > Granular."}]} {"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 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": "Give me a complete SuperCollider patch for Wake up call: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "What does `UScore.addEventsToEmptyRegion` do? What arguments does it take?"}, {"role": "assistant", "content": "(describe method Arguments: events — (describe argument here). Returns: (returnvalue)"}]} {"conversations": [{"role": "user", "content": "What does `SCluster.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": "Write a kick drum with a 0.18 s decay. (osc sine, sweep 0.06, decay 0.18, f0 150, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\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 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": "Write an Ndef with a blip source and a 3200 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_220_3200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `Polar` in SuperCollider?"}, {"role": "assistant", "content": "Polar — Polar coordinates Represents polar coordinates. Category: Math."}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Pwalk, dur 0.3, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\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(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": "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": "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": "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 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 Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.2, octave 5, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Instr.papply` do? What arguments does it take?"}, {"role": "assistant", "content": "partial application : fix certain args with the supplied object. returns a Arguments: ... args — either a dict or a list. if a list then non nil arguments will."}]} {"conversations": [{"role": "user", "content": "What is `TWChoose` in SuperCollider?"}, {"role": "assistant", "content": "TWChoose — Randomly select one of several inputs An output is selected randomly on receiving a trigger from an array of inputs. Category: UGens > Triggers, UGens > Random."}]} {"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 `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": "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 `WebView.onLoadStarted` do?"}, {"role": "assistant", "content": "Sets the object to be evaluated when a page load"}]} {"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": "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 `Demand` in SuperCollider briefly."}, {"role": "assistant", "content": "Demand — Demand results from demand rate UGens. When there is a trigger at the trig input, a value is demanded each UGen in the list and output. The unit generators in the list should be 'demand' rate. Category: UGens > Demand."}]} {"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 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 `Point.rho` do?"}, {"role": "assistant", "content": "Return the polar coordinate radius of the"}]} {"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 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 `MxUnitApp.dup` do? What arguments does it take?"}, {"role": "assistant", "content": "Duplicate the object to the slot directly below it, insert an open space if there is already something Arguments: num — How many times to duplicate. Returns: unit or array of units"}]} {"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 `PSVop_o` in SuperCollider briefly."}, {"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": "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": "Explain `MxChannelApp` in SuperCollider briefly."}, {"role": "assistant", "content": "MxChannelApp — scripting object for an MxChannel, one channel in an Mx Add, remove, insert units. Mute, solo and change levels on the fader. Category: Mx."}]} {"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 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": "What does `RedObject.update` do?"}, {"role": "assistant", "content": "Moves the object by updating the #-loc, #-vel and #-accel instance"}]} {"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 an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_165_400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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": "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": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 1400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 1400 Hz low-pass\n(\nNdef(\\nd_blip_110_1400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 800 Hz low-pass."}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: saw source through a 800 Hz low-pass\n(\nNdef(\\nd_saw_110_800, { |freq = 110, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `RHPF` in SuperCollider?"}, {"role": "assistant", "content": "RHPF — A resonant high pass filter. Category: UGens > Filters > Linear."}]} {"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 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": "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": "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// 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": "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": "Give me an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 1400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I put a kick in a reverb at mix 0.45? (verb gverb, room 0.85, damp 0.2, mix 0.45, source kick)"}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: gverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = GVerb.ar(sig, 68.0, 3, 0.2, 0.5, 15, 0.4, 0.3, 0.45);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 220 Hz and falls to 40 Hz?"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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": "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": "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 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 `RedRamp` in SuperCollider?"}, {"role": "assistant", "content": "RedRamp — resettable phasor with per period rate control Useful for scanning through a buffer with different speeds each time. Category: Red > redUGens."}]} {"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 an Ndef with an LFO at 0.8 Hz. (ugens saw, cutoff 400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 400 Hz low-pass\n(\nNdef(\\nd_saw_55_400, { |freq = 55, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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": "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 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": "Explain `Gbman2DN` in SuperCollider briefly."}, {"role": "assistant", "content": "Gbman2DN — gingerbreadman map 2D chaotic generator `x(n+1) = 1 - y(n) + |x(n)|` Category: UGens > Generators > Stochastic."}]} {"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": "Write a self-contained SuperCollider patch that uses `Dbrown`. Define every value it uses."}, {"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": "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": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\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": "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 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": "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": "Write a Pbind in majorPentatonic using Pwalk for the degrees. (scale majorPentatonic, seq Pwalk, dur 0.25, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 220 Hz? (ugens sine, cutoff 1400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_220_1400, { |freq = 220, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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": "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{ 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": "Write a Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Prand, dur 0.2, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\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 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 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": "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 `VarGui.update` do?"}, {"role": "assistant", "content": "Update variables and controllers to current slider values. Like update button action. Unless the VarGui window was generated with option updateNow set to false, variables and controllers are immediately set to slider values and normally updating is not"}]} {"conversations": [{"role": "user", "content": "What does `Mx.removeChannel` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: index."}]} {"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": "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 granular texture, dry. (rate 28, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\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": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 1400, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\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": "What does `View.acceptsMouseOver` do? What arguments does it take?"}, {"role": "assistant", "content": "If this is a top view, this variable defines whether the view and all its children receive mouse-over events. The default is `false`. See also: Arguments: A Boolean.."}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Ball` and actually plays. Assume nothing about the session."}, {"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": "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": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 20 grains per second. (rate 20, dur 0.04, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.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(\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": "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 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 granular texture, through a reverb. (rate 20, dur 0.15, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.15, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.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{\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": "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 `RedBase64` in SuperCollider briefly."}, {"role": "assistant", "content": "RedBase64 — base64 encoding/decoding See http://en.wikipedia.org/wiki/Base64 Category: Red > redTools."}]} {"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": "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": "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": "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 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 `Env.plot` do? What arguments does it take?"}, {"role": "assistant", "content": "Plot this envelope's shape in a Arguments: size — The size of the plot. The default is 400.; bounds — the size of the plot window.; minval — the minimum value in the plot. Defaults to the lowest value in the data.; maxval — the maximum value in the plot. Defaults to the highest value in the data.; name — the plot window's label name. If nil, a name will be created for you.; 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": "Write an Ndef at 55 Hz I can retune while it plays. (ugens sine, cutoff 200, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_55_200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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\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 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": "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": "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": "What does `SimpleNumber.gammaPDerivative` do?"}, {"role": "assistant", "content": "Implements the partial derivative with respect to x of the incomplete gamma function"}]} {"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 `BusPool.busses` do?"}, {"role": "assistant", "content": "bus allocator with retain/release counting for shared busses"}]} {"conversations": [{"role": "user", "content": "What is `HPZ2` in SuperCollider?"}, {"role": "assistant", "content": "HPZ2 — Two zero fixed midcut. A special case fixed filter. Implements the formula: Category: UGens > Filters > Linear."}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 2400, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_55_2400, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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// 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\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": "Write a kick at amp 0.8 with no click. (osc sine, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `VarGui.load_old` do? What arguments does it take?"}, {"role": "assistant", "content": "Create a VarGui, that loads a stored slider state from the specified file. This is for loading slider states that have been saved with miSCellaneous v0.3 or earlier, thus ignoring the synth control slider label. Though old code examples will not necessarily work after just replacing load by load_old as other conventions have changed too. Maybe you'd also have to change synth and stream (former players) or add assumePlaying and assumeRunning Arguments: pathname — Pathname string.; filename — Filename string.; stream — see VarGui#*new.; synth — see VarGui#*new.; clock — see VarGui#*new.; quant — see VarGui#*new.; varEnvirGroups — see VarGui#*new.; envir — see VarGui#*new.."}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PV_PhaseShift`: bind everything it needs first."}, {"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": "Write a complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// define a control\nSynthDef(\"line\", { arg i_bus=10, i_start=1000, i_end=500, i_time=1;\n ReplaceOut.kr(i_bus, Line.kr(i_start, i_end, i_time, doneAction: Done.freeSelf));\n}).add\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": "What does `SoundFileView.readFile` do? What arguments does it take?"}, {"role": "assistant", "content": "Reads a section of an open instance of SoundFile, and displays it in the view. For large files, you may want to use the method readWithTask instead. The 'block' argument has no effect; the display resolution is Arguments: aSoundFile — An open instance of SoundFile.; 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": "Explain `PV_ExtractRepeat` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_ExtractRepeat — extract a repeating loop out from audio If you have a signal that consists of some fixed looping audio (e.g. a beat) plus some varying content (e.g. singing), this UGen uses a simple binary-masking technique to try and separate the looping bit from the non-looping bit. The quality of the separation is quite rough, but useful in some circumstances. Category: UGens > FFT, UGens > Analysis."}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 165 Hz? (ugens sine, cutoff 3200, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_165_3200, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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": "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 `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": "Give me an Ndef with an LFO at 0.3 Hz. (ugens tri, cutoff 800, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 800 Hz low-pass\n(\nNdef(\\nd_tri_82_800, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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 does `QPalette.highlightText` do?"}, {"role": "assistant", "content": "Convenience method to get or set the color for the 'highlightText'"}]} {"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": "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": "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": "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": "How do I granulate a sample with 0.1 s grains? (rate 6, dur 0.1, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "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 `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": "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 `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": "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// 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": "Explain `ControlPrototypes` in SuperCollider briefly."}, {"role": "assistant", "content": "ControlPrototypes — creates default objects for Spec / argName combinations This is a registery of controls, cataloged by the Spec of their output. It was used by Patch to procure suitable control objects to satisfy an argument to a function. Category: Libraries > crucial > Instr."}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 20, dur 0.2, interp 2, mode noise, rev 1)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.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{ 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": "Explain `Pkey` in SuperCollider briefly."}, {"role": "assistant", "content": "Pkey — access a key in an event stream Pkey simplifies backward access to values in an event being processed by Pbind or another event pattern. Category: Streams-Patterns-Events > Patterns > Data Sharing."}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.18, f0 220, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "What does `MxQuery.whereIsKindOf` do? What arguments does it take?"}, {"role": "assistant", "content": "Filters where source object is of the class or a subclass of Arguments: class. Returns: an MxQuery with the selected results"}]} {"conversations": [{"role": "user", "content": "What is `MxUnitApp` in SuperCollider?"}, {"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 is `PMouseX` in SuperCollider?"}, {"role": "assistant", "content": "PMouseX — UGenPatterns quark library Based on MouseX Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} {"conversations": [{"role": "user", "content": "What is `ChooseCutProc` in SuperCollider?"}, {"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": "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 do I play a random minorPentatonic scale at octave 6? (scale minorPentatonic, seq Prand, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\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": "Explain `Resonz` in SuperCollider briefly."}, {"role": "assistant", "content": "Resonz — Resonant filter. This is the same as Ringz, except that it has a constant gain at 0 dB instead of being constant skirt. Category: UGens > Filters > Linear."}]} {"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": "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 Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\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 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 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": "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": "Explain `EaseOutQuart` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutQuart — Quartic ease-out Easing equation for a quartic (t^4) ease-out, decelerating to 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(\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": "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": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pshuf, dur 0.4, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `ScrollView.autohidesScrollers` do?"}, {"role": "assistant", "content": "Sets or gets whether the view hides one or another scrollbar if the contents do not exceed the view's bounds in the scrollbar's direction. If #-hasHorizontalScroller or #-hasVerticalScroller is set to `false`, the respective scrollbar will always be hidden, regardless of this policy. Defaults to"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Scheduler.sched` do?"}, {"role": "assistant", "content": "Schedule the task at `delta` seconds relative to the current time, as defined by the `drift` argument of the #*new#constructor. Regardless of what time a task is scheduled, it will only be awaken the next time #-seconds is"}]} {"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 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": "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(\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 is `BBCut2` in SuperCollider?"}, {"role": "assistant", "content": "BBCut2 — splices and reassembles audio This help file is for the BBCut2 class. For an overview of the BBCut2 library, see BBCut . Category: Libraries > BBCut > Core."}]} {"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 `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": "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 `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": "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": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_82_2400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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 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": "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": "What does `LinearSpline.xypoints` do?"}, {"role": "assistant", "content": "For use by the gui, this returns the point array as Point objects, discarding any higher"}]} {"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `Dwrand` that runs as it is."}, {"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": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "Write a Pbind in majorPentatonic using Pseq for the degrees."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `PLshufn` in SuperCollider briefly."}, {"role": "assistant", "content": "PLshufn — dynamic scope Pshufn variant Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx_suite. A PLshufn stream keeps on choosing permutations for the current list. See PLshuf for keeping one permutation. Category: Libraries > miSCellaneous > PLx suite, Streams-Patterns-Events > PLx suite."}]} {"conversations": [{"role": "user", "content": "What does `Timer.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Returns time since last triggered. Arguments: trig — A trigger occurs when trig signal crosses from non-positive to positive.."}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `BinaryOpUGen` and actually plays. Assume nothing about the session."}, {"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": "How do I build a live drone with Ndef at 82.5 Hz? (ugens sine, cutoff 800, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 800 Hz low-pass\n(\nNdef(\\nd_sine_82_800, { |freq = 82.5, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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": "What does `RedOnePole.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "one pole filter with separate up and down coefficients Arguments: in — The signal to be filtered.; up — Lag amount for increasing numbers.; down — Lag amount for decreasing numbers. If nil then set to same as up.."}]} {"conversations": [{"role": "user", "content": "Write a kick whose tail uses gverb."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: gverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = GVerb.ar(sig, 56.0, 3, 0.2, 0.5, 15, 0.4, 0.3, 0.3);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\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": "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 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": "Explain `TDelay` in SuperCollider briefly."}, {"role": "assistant", "content": "TDelay — Trigger delay. Delays a trigger by a given time. Any triggers which arrive in the time between an input trigger and its delayed output, are ignored. Category: UGens > Triggers, UGens > Delays."}]} {"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": "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 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 complete SuperCollider patch built around `TChoose` that runs as it is."}, {"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": "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 an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 1400, lfo 0.1, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 1400 Hz low-pass\n(\nNdef(\\nd_saw_82_1400, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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 `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": "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 `Lorenz2DC.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": "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": "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": "How do I make a kick that starts at 220 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.25, f0 220, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Fomus.fileName` do?"}, {"role": "assistant", "content": "Base filename, suffix will be added. Default is"}]} {"conversations": [{"role": "user", "content": "What is `CombC` in SuperCollider?"}, {"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": "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": "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": "What does `FOS.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "First order filter section. Arguments: in — Signal input.; a0 — See formula above.; a1 — See formula above.; b1 — See formula above.; mul; add."}]} {"conversations": [{"role": "user", "content": "What is `Editor` in SuperCollider?"}, {"role": "assistant", "content": "Editor — holds a value that can be edited with a GUI, saves as the value This is the parent class for all Editors and also has a repository of handlers that are used to find the appropriate editor for a given object. Category: Libraries > crucial > Editors."}]} {"conversations": [{"role": "user", "content": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.25, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale majorPentatonic, seq Pseq, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens blip, cutoff 200, lfo 0.3, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_220_200, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `PV_BrickWall`: bind everything it needs first."}, {"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 Pbind in majorPentatonic using Pseq for the degrees. (scale majorPentatonic, seq Pseq, dur 0.2, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.2 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.3 Hz. (ugens sine, cutoff 400, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 400 Hz low-pass\n(\nNdef(\\nd_sine_165_400, { |freq = 165, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `FSinOsc`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n{ // distorts and envelopes z\nvar z;\nz = FSinOsc.ar(500);\nz min: FSinOsc.ar(0.1);\n}.play;\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 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": "Explain `FoaAsymmetry` in SuperCollider briefly."}, {"role": "assistant", "content": "FoaAsymmetry — First Order Ambisonic (FOA) asymmetry transformer Apply asymmetry to a First Order Ambisonic signal (B-format). Category: Libraries > Ambisonic Toolkit > UGens > FOA > Transformer, UGens > Multichannel > Ambisonics."}]} {"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": "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 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": "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": "What is `Chromagram` in SuperCollider?"}, {"role": "assistant", "content": "Chromagram — Octave chroma band based representation of energy in a signal; Chromagram for nTET tuning systems with any base reference A chromagram, measuring the energy at particular chroma within an nTET tuning system. Category: UGens > Analysis."}]} {"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": "What does `ArraySpec.storeArgs` do?"}, {"role": "assistant", "content": "datatype specifying an array with an itemSpec which describes its items"}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 4? (scale minorPentatonic, seq Pwalk, dur 0.3, octave 4, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\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 `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": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Point.dist` do?"}, {"role": "assistant", "content": "Return the distance from the receiver to"}]} {"conversations": [{"role": "user", "content": "What does `MxQuery.copyBy` do? What arguments does it take?"}, {"role": "assistant", "content": "Copies rather than moves. See Arguments: vector."}]} {"conversations": [{"role": "user", "content": "What does `PV_ChainUGen.pvcalc` do? What arguments does it take?"}, {"role": "assistant", "content": "pvcalc applies a function to the frequency-domain data of an FFT chain. See #-pvcollect below for discussion of efficiency considerations. See also #-pvcalc2 below, and UnpackFFT. `chain = chain.pvcalc(numframes, func, frombin, tobin, Arguments: numframes — Number of FFT frames to process; func — The function that takes two arrays as inputs (`magnitude`, and `phase`) and returns a resulting pair of arrays `[magnitude, phase]`. `// example function`; frombin — Range start (optional); tobin — Range end (optional); zeroothers — If set to 1 then bins outside of the range being processed are silenced.."}]} {"conversations": [{"role": "user", "content": "How do I put a bell in a reverb at mix 0.45? (verb freeverb2, room 0.5, damp 0.2, mix 0.45, source bell)"}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.5, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `Dust` in SuperCollider?"}, {"role": "assistant", "content": "Dust — Random impulses. Generates random impulses from 0 to +1. Category: UGens > Generators > Stochastic."}]} {"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\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": "Write an Ndef at 82.5 Hz I can retune while it plays. (ugens tri, cutoff 200, lfo 0.3, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_82_200, { |freq = 82.5, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `CXLabel` in SuperCollider?"}, {"role": "assistant", "content": "CXLabel — a simple convience class to create a label Category: Libraries > crucial > GUI."}]} {"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": "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{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{ 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": "What does `Dust.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Random impulses. Arguments: density — Average number of impulses per second.; 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 `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 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": "Give me a granular patch with noise grain position and interp 4. (rate 6, dur 0.04, interp 4, mode noise, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\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(\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 `CXAbstractLabel.label` do? What arguments does it take?"}, {"role": "assistant", "content": "parent class for Label classes Arguments: string."}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a saw source and a 200 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 200 Hz low-pass\n(\nNdef(\\nd_saw_82_200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens saw, cutoff 2400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 2400 Hz low-pass\n(\nNdef(\\nd_saw_220_2400, { |freq = 220, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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 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 `ArrayMin` in SuperCollider briefly."}, {"role": "assistant", "content": "ArrayMin — detect the smallest value (and its position) in an array of UGens Finds the minimum value in an Array of UGens, and outputs the value and the index. Category: UGens > Multichannel, UGens > Analysis."}]} {"conversations": [{"role": "user", "content": "What does `LocalBuf.newFrom` do? What arguments does it take?"}, {"role": "assistant", "content": "Allocates a new buffer from a given list of Arguments: list — The list may be two-dimensional for numChannels > 1. It is then reshaped into the buffer's current format by flattening.. Returns: a new buffer"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.4 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 5,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\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": "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 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": "Write a kick at amp 0.6 with no click. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "How do I build a live drone with Ndef at 55 Hz?"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_55_3200, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second."}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a kick drum with a 0.18 s decay. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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": "Add freeverb to a kick patch at room 0.85."}, {"role": "assistant", "content": "A send-style patch: dry signal plus the reverb on the tail:\n\n```supercollider\n// reverb: freeverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.85, 0.2);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"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 `EnvelopeView.value` do? What arguments does it take?"}, {"role": "assistant", "content": "`value` retrieves the node positions, returning an array in the format of the Argument below. `value_(anArray)` Sets the positions of the nodes, creating them if not existent. If there were already existent nodes and their amount is different than the amount of x/y pairs in the argument, nodes will be added or removed (in order of creation reversed) until the amounts match, and then the new values will be Arguments: An Array containing two other Arrays, of which one contains the horizontal and the other the vertical position of the new nodes. The values must be between 0 and 1. For example: `[[x1, x2, x3, ...], [y1, y2, y3, ...]]`."}]} {"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 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 `HilbertHIm.calcCoeffs` 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": "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 `MxCable.inlet` do?"}, {"role": "assistant", "content": "the inlet where the cable goes Returns: MxInlet"}]} {"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 a SuperCollider patch that uses `Dibrown` and actually plays. Assume nothing about the session."}, {"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": "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": "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": "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": "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 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 `MultiSplineFr.setValue` do? What arguments does it take?"}, {"role": "assistant", "content": "Multi dimensional spline frame rate device Arguments: value; 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": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.25, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `SimpleNumber.ellintRj` do?"}, {"role": "assistant", "content": "Returns Carlson's Elliptic Integral RJ. Requires that `x,y,z >= 0`, with at most one of them zero, and that `p !="}]} {"conversations": [{"role": "user", "content": "What does `Latoocarfian2DL.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": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 800, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_110_800, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `PLFNoise0` in SuperCollider?"}, {"role": "assistant", "content": "PLFNoise0 — UGenPatterns quark library Based on LFNoise0 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 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": "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 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": "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": "What does `EnvelopeView.setFillColor` do? What arguments does it take?"}, {"role": "assistant", "content": "Sets the color used to draw the inside of the node at the given Arguments: index — An Integer.; color — A Color.."}]} {"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 `GUI.add` do? What arguments does it take?"}, {"role": "assistant", "content": "Registers a new scheme. This is typically called by external libraries in their startup procedure. If a scheme with the same identifier (`scheme.id`) exists, it is Arguments: aScheme — The scheme to add.."}]} {"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, { Blip.ar(Ndef.kr(\\maus) * 70) }).play;\nNdef(\\haus).reshaping = \\elastic;\nNdef(\\maus).reshaping = \\elastic;\nNdef(\\maus, { LFNoise0.kr(1 ! 8) + 1 }; // now 8 parallel channels of audio are audible.\n```"}, {"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, { Blip.ar(Ndef.kr(\\maus) * 70) }).play;\nNdef(\\haus).reshaping = \\elastic;\nNdef(\\maus).reshaping = \\elastic;\nNdef(\\maus, { LFNoise0.kr(1 ! 8) + 1 }); // now 8 parallel channels of audio are audible.\n```"}]} {"conversations": [{"role": "user", "content": "What is `Sieve` in SuperCollider?"}, {"role": "assistant", "content": "Sieve — Container class for sieve lists Container for a list of ascending integers as 'points' or 'intervals'. 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 `BBCutBlock` in SuperCollider briefly."}, {"role": "assistant", "content": "BBCutBlock — A block of audio in BBCut2 Rendering in BBCut occurs a block at a time. What is a block? You can think of it as a roll where all events share a common buffer starting position. The BBCutBlock holds all messages and functions to be rendered for that roll. These will enter the scheduling queue when renderBlock is called, all being converted to Events that know how to play themselves (each is at least (play:{\"do something\".pos Category: Libraries > BBCut > Core."}]} {"conversations": [{"role": "user", "content": "What does `ClassNameLabel.new` do? What arguments does it take?"}, {"role": "assistant", "content": "a button for displaying an Class name that links to a ClassGui in debugging interfaces Arguments: class; 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.; minHeight — default is GUI.skin.buttonHeight; font. Returns: (returnvalue)"}]} {"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 `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": "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": "What does `Platform.killAll` do? What arguments does it take?"}, {"role": "assistant", "content": "kill all processes as defined by Arguments: cmdLineArgs — a string containing one or several process names.; force — if true (default), the process will be closed forcefully, using `killall -KILL` on *nix and `taskkill /f` on Windows. `// e.g. kill all possibly running servers (scsynth or supern`."}]} {"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 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// 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// 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 does `JITGui.getState` do?"}, {"role": "assistant", "content": "ask the object for all aspects of its current state that will be"}]} {"conversations": [{"role": "user", "content": "Explain `NTube` in SuperCollider briefly."}, {"role": "assistant", "content": "NTube — physical modeling simulation; N tubes Physical model; N tube sections with N-1 scattering junctions inbetween; relative areas determine k for each junction, where each junction has its own associated k. Delay lengths can be fractional and varied on the fly. Each junction also has an associated loss, as well as for the two outer feedback connections, giving N+1 loss factors. Category: UGens > PhysicalModels //SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://composerprogrammer.com/index.html."}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.8 Hz. (ugens blip, cutoff 400, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_82_400, { |freq = 82.5, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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// 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": "Show me a self-contained SuperCollider patch using `Dswitch`: bind everything it needs first."}, {"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": "Give me a Pbind with fm voices and a 0.4 rhythm. (scale minorPentatonic, seq Pseq, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"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 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 `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": "What does `Fhn2DL.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "FitzHughNagumo Neuron Firing Oscillator Arguments: minfreq, maxfreq — freq iteration; rateu — update rate for u; ratew — update rate for w; b0 — equation constant; b1 — equation constant; i — arbitrary external impulse; i.e. pulse wave, trigger, lfnoise, or nothing.; initu — reset value for u; initw — reset value for w."}]} {"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, 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```"}, {"role": "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, 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\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 `RedGIFControl.transparent` do?"}, {"role": "assistant", "content": "An Integer index in the colorMap array (only valid if transparentFlag below is"}]} {"conversations": [{"role": "user", "content": "What does `Mx.prRemoveChannel` do? What arguments does it take?"}, {"role": "assistant", "content": "A mixer and dynamic patching Arguments: index."}]} {"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(\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": "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 `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 `PSVdif_oi.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Creates a new PSVdif_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": "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 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 an Ndef with a blip source and a 200 Hz low-pass. (ugens blip, cutoff 200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_165_200, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\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": "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 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": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.18, f0 150, f1 55, amp 0.8, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `RedEffectModuleGUI.params` do?"}, {"role": "assistant", "content": "An Array of Associations from module metadata (argument"}]} {"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 `RedMRCM` in SuperCollider briefly."}, {"role": "assistant", "content": "RedMRCM — multiple reduction copy machine Plotting with Pen. After Flake - \"The Computational Beauty of Nature\". Category: Red > redUniverse > additional."}]} {"conversations": [{"role": "user", "content": "How do I granulate a sample with 0.2 s grains? (rate 6, dur 0.2, interp 4, mode noise, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `OSCresponderNode` in SuperCollider?"}, {"role": "assistant", "content": "OSCresponderNode — client side network responder Category: External Control > OSC."}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.4, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\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{ 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 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\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": "Give me a saw kick with a 0.06 s pitch sweep. (osc saw, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.6, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `HoaFocus` in SuperCollider?"}, {"role": "assistant", "content": "HoaFocus — Higher Order Ambisonic (HOA) focus transformer Apply focus to a Higher Order Ambisonic signal (HOA) along an arbitrary axis & radius. Category: Libraries > Ambisonic Toolkit > UGens > HOA > Transformer, UGens > Multichannel > Ambisonics."}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Nuclear Fallout (a SuperCollider snippet). Define every value it uses."}, {"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 Pbind in minorPentatonic using Pshuf for the degrees. (scale minorPentatonic, seq Pshuf, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\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": "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": "How do I make a kick that starts at 150 Hz and falls to 55 Hz? (osc sine, sweep 0.06, decay 0.35, f0 150, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 55], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "Explain `Pmulpre` in SuperCollider briefly."}, {"role": "assistant", "content": "Pmulpre — multiplies with value of a key in event stream, before it is passed up Multiplies with a value in an event, before it is passed up the stream. To multiply with the value after it has been passed down, use Pmul. Category: Streams-Patterns-Events > Patterns > Math."}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 400, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 400 Hz low-pass\n(\nNdef(\\nd_tri_110_400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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\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 `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 `MxTimeGui.guify` do? What arguments does it take?"}, {"role": "assistant", "content": "Timeline view Arguments: parent; bounds; title."}]} {"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `LFPulse` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n4.insp;\n[1,2,3].insp;\nPageLayout.insp;\nSynthDef(\"yawn\",{ arg freq=100;\n Out.ar(0,Saw.ar * LFPulse.kr(3))\n}).insp;\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 `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 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 `DataFilterBandpass.constants` do?"}, {"role": "assistant", "content": "a dictionary of dictionaries containing filter constants for different sampling rates. `//filter constants for 1-15 Hz, 250 samples per"}]} {"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": "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": "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 `Array.belaScope` do? What arguments does it take?"}, {"role": "assistant", "content": "Send this Array's content to Bela's Oscilloscope (see BelaScope for required Arguments: scopeChannel — Bela's oscilloscope channel to start scoping on. This has to be a non-negative number, and can't be changed after scoping starts.; server — The server on which BelaScope is running. If not specified, it looks for the first server for which BelaScope was already initialized. If none is found, it attempts to initialize a BelaScope instance on Server#*default.. Returns: This Array."}]} {"conversations": [{"role": "user", "content": "Write a kick whose tail uses freeverb. (verb freeverb, room 0.85, damp 0.5, mix 0.45, source kick)"}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: freeverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb.ar(sig, 0.45, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `Ppoisson` in SuperCollider?"}, {"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 is `Knob` in SuperCollider?"}, {"role": "assistant", "content": "Knob — A rotary controller view Knob displays a value from 0.0 to 1.0 in rotary fashion, and allows to control it with either circular or linear mouse motion. Category: GUI > Views."}]} {"conversations": [{"role": "user", "content": "How do I play a random minorPentatonic scale at octave 5? (scale minorPentatonic, seq Pshuf, dur 0.25, octave 5, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `AnalogIn`: bind everything it needs first."}, {"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 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\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": "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": "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": "What does `View.focusColor` do? What arguments does it take?"}, {"role": "assistant", "content": "Get or set the color used to display keyboard focus on the Arguments: A Color.."}]} {"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 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 `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 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 `ControlSpec.new` do? What arguments does it take?"}, {"role": "assistant", "content": "numerical input specification Arguments: minval — The minimum value of the range.; maxval — The maximium value of the range.; warp — a Warp, a symbol (e.g. \\lin or \\exponential: Default value is \\lin), or something else that returns a Warp when sent the message .asWarp. A CurveWarp is defined by a number.; step — The smallest possible increment.; default — The default value.; units — The units, e.g. \"hz\". Used by some gui's as a unit label.; grid."}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 220 Hz I can retune while it plays. (ugens blip, cutoff 400, lfo 0.1, freq 220, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 400 Hz low-pass\n(\nNdef(\\nd_blip_220_400, { |freq = 220, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `OrderedIdentitySet` in SuperCollider briefly."}, {"role": "assistant", "content": "OrderedIdentitySet — a set according to identity An OrderedIdentitySet 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). Unlike IdentitySet, contents of an OrderedIdentitySet are ordered. Category: Collections > Ordered."}]} {"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 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": "What does `ServerGui.guiBody` do? What arguments does it take?"}, {"role": "assistant", "content": "an alternate small server view Arguments: layout."}]} {"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 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 GrainBuf synth at 14 grains per second. (rate 14, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Integrator.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "A leaky integrator. Arguments: in — The input signal.; coef — Leak coefficient.; mul — Output will be multiplied by this value.; add — This value will be added to the output.."}]} {"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": "How do I build a live drone with Ndef at 165 Hz? (ugens blip, cutoff 2400, lfo 0.8, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_165_2400, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `OpenBCIboard` in SuperCollider?"}, {"role": "assistant", "content": "OpenBCIboard — Abstract class for all OpenBCI boards superclass for all hardware boards Category: External Control."}]} {"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": "What is `RedPendulum` in SuperCollider?"}, {"role": "assistant", "content": "RedPendulum — an object that oscillates Category: Red > redUniverse."}]} {"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 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 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": "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 = 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```"}, {"role": "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 = 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": "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 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": "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": "What does `Function.envirFlop` do?"}, {"role": "assistant", "content": "This method is kept for backward compatibility. Use `flop`"}]} {"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 `MassEditUChain.prepareWaitAndStart` 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": "How do I put a kick in a reverb at mix 0.3? (verb gverb, room 0.5, damp 0.2, mix 0.3, source kick)"}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: gverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = GVerb.ar(sig, 40.0, 3, 0.2, 0.5, 15, 0.4, 0.3, 0.3);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\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": "How do I build a live drone with Ndef at 110 Hz? (ugens blip, cutoff 200, lfo 0.3, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 200 Hz low-pass\n(\nNdef(\\nd_blip_110_200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * 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(\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 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 an Ndef with a sine source and a 1400 Hz low-pass. (ugens sine, cutoff 1400, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 1400 Hz low-pass\n(\nNdef(\\nd_sine_55_1400, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `KeyCodeResponder.register` do? What arguments does it take?"}, {"role": "assistant", "content": "for shift, caps,opt,cntl true indicates a required modifier false indicates an excluded modifier nil expresses that you really don't care one way or the Arguments: keycode; shift; caps; opt; cntl; function."}]} {"conversations": [{"role": "user", "content": "What does `Symbol.isBinaryOp` do?"}, {"role": "assistant", "content": "Return true if the symbol is a valid binary operator. A valid binary operator contains only the symbols `!@%&*-+=|<>?/`, does not start with '`//`' or '`/*`', and is not the string"}]} {"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": "Show me a self-contained SuperCollider patch using `Recorder`: bind everything it needs first."}, {"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 is `Bag` in SuperCollider?"}, {"role": "assistant", "content": "Bag — Unordered collection of objects A Bag is an unordered collection of objects. In some languages it is referred to as a counted set. A Bag keeps track of the number of times objects are inserted and requires that objects be removed the same number of times. There is only one instance of an object in a Bag even if the object has been added to the Bag multiple times (test is for equality) Category: Collections > Unordered."}]} {"conversations": [{"role": "user", "content": "Explain `EaseOutInCubic` in SuperCollider briefly."}, {"role": "assistant", "content": "EaseOutInCubic — Cubic ease-out/in Easing equation for a cubic (t^3) ease-out/in, decelerating until halfway, then accelerating. Category: Ease."}]} {"conversations": [{"role": "user", "content": "Write a Pbind in majorPentatonic using Prand for the degrees. (scale majorPentatonic, seq Prand, dur 0.25, octave 6, instr pluck, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Prand degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `BelaScope` in SuperCollider?"}, {"role": "assistant", "content": "BelaScope — Bela's Oscilloscope interface Category: UGens > Bela."}]} {"conversations": [{"role": "user", "content": "What is `Rand` in SuperCollider?"}, {"role": "assistant", "content": "Rand — Single random number generator. Generates a single random float 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": "How do I make a kick that starts at 150 Hz and falls to 48 Hz? (osc fm, sweep 0.06, decay 0.18, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `OSCSched.sched` do? What arguments does it take?"}, {"role": "assistant", "content": "delta specified in Arguments: beats; server; bundle; onArrival."}]} {"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": "Explain `PV_Copy` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_Copy — Copy an FFT buffer Copies the spectral frame in `bufferA` to `bufferB`. This allows for parallel processing of spectral data without the need for multiple FFT UGens. Further it allows to extract data at a given point in the FFT chain e.g. for monitoring purposes. 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{ 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": "Explain `Fb1_Lorenz` in SuperCollider briefly."}, {"role": "assistant", "content": "Fb1_Lorenz — Lorenz pseudo ugen Fb1_ODE wrapper for the Lorenz ODE system: 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\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 `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": "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 `UnicodeResponder.put` do? What arguments does it take?"}, {"role": "assistant", "content": "register responder functions for unicode and modifier combinations Arguments: address; val."}]} {"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": "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 `Instr.storeArgs` do?"}, {"role": "assistant", "content": "An enhanced version of SynthDef with a library"}]} {"conversations": [{"role": "user", "content": "What is `FoaEncoderMatrix` in SuperCollider?"}, {"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": "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": "What does `Function.performDegreeToKey` do?"}, {"role": "assistant", "content": "use a function as a conversion from scale degree to note number. See also SequenceableCollection and Scale `// a strange"}]} {"conversations": [{"role": "user", "content": "Explain `LFGauss` in SuperCollider briefly."}, {"role": "assistant", "content": "LFGauss — Gaussian function oscillator A non-band-limited gaussian function oscillator. Category: UGens > Generators > Deterministic."}]} {"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 `PV_RectComb`. Define every value it uses."}, {"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 `TextView.select` do? What arguments does it take?"}, {"role": "assistant", "content": "A view displaying editable formatted text Arguments: start — An Integer position within the text, in characters.; size — An Integer amount of characters.."}]} {"conversations": [{"role": "user", "content": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.18, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pwalk cycle. (scale majorPentatonic, seq Pwalk, dur 0.25, octave 6, instr fm, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `HilbertHRe.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "Applies the Real part of the Hilbert Transform to an input signal. [1] Arguments: in — The input signal to transform.; size — The size of the kernel used for Hartley Phasing filtering.; mul — Output will be multiplied by this value.; add — This value will be added to the output.. Returns: The real part of the Hilbert Transform."}]} {"conversations": [{"role": "user", "content": "Write a complete SuperCollider patch built around `TIRand` that runs as it is."}, {"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": "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": "Who made you?"}, {"role": "assistant", "content": "I am sc-mind, trained by this repository from a six-source SuperCollider corpus and a supervised set whose code answers were compiled with sclang before they were written."}]} {"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": "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(\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": "What does `NodeWatcher.newFrom` do?"}, {"role": "assistant", "content": "Create a new instance listening to the server's address. If there is one present already return that"}]} {"conversations": [{"role": "user", "content": "What is `NotNil` in SuperCollider?"}, {"role": "assistant", "content": "NotNil — validates that the tested object is not nil Category: Libraries > crucial > Constraints."}]} {"conversations": [{"role": "user", "content": "Write a granular texture, dry."}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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": "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": "What does `ControlPrototypes.define` do? What arguments does it take?"}, {"role": "assistant", "content": "Keys are either symbols or classes, the values are functions that return arrays of prototypes. Patch simply selects the first in the list. Other methods of ControlPrototypes use the full list. The function is valued each time so that the control is a unique instance. You may freely change or redefine control protypes while working/composing without recompiling. This class also serves to decouple Spec from knowing of the various controls, gadgets and Arguments: ... assns."}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens blip, cutoff 3200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 3200 Hz low-pass\n(\nNdef(\\nd_blip_110_3200, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `SimpleNumber.cylNeumannZero` do?"}, {"role": "assistant", "content": "Returns a single zero or root of the Neumann function (Bessel function of the second kind). `index` is a 1-based index of zero of the cylindrical Neumann function of order"}]} {"conversations": [{"role": "user", "content": "Give me a fm kick with a 0.06 s pitch sweep. (osc fm, sweep 0.06, decay 0.5, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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 is `OSCBundle` in SuperCollider?"}, {"role": "assistant", "content": "OSCBundle — network bundle object A bundle object that allows to add preparation messages for async processes. If this feature is not needed, a list object can be used instead. Category: External Control > OSC."}]} {"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 `RedAutoScale` in SuperCollider briefly."}, {"role": "assistant", "content": "RedAutoScale — scales an unknown signal to a known range Uses RunningMin and RunningMax as scaling range and can scale signals automatically to a specified range. Category: Red > redUGens."}]} {"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 an Ndef at 82.5 Hz I can retune while it plays. (ugens saw, cutoff 3200, lfo 0.8, freq 82.5, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: saw source through a 3200 Hz low-pass\n(\nNdef(\\nd_saw_82_3200, { |freq = 82.5, amp = 0.12|\n var sig = Saw.ar([freq, freq * 1.007]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\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 `NetAddr.matchLangIP` do? What arguments does it take?"}, {"role": "assistant", "content": "Test an IP address to see if it matches any local IP address. See also Arguments: ipstring — A String to test containing an IP number in dot decimal notation (e.g. \"192.168.34.56\").. Returns: A Boolean indicating whether a match was found."}]} {"conversations": [{"role": "user", "content": "Explain `SyntheticData` in SuperCollider briefly."}, {"role": "assistant", "content": "SyntheticData — for generating synthetic test data coming from a board this class acts like a drop-in replacement for CytonSerial and CytonWifi. Category: External Control."}]} {"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 is `FoaAlpha` in SuperCollider?"}, {"role": "assistant", "content": "FoaAlpha — First Order Ambisonic (FOA) Soundfield Active-Reactive Intensity Balance Return the Active-Reactive Intensity Balance of a first order ambisonic (B-format) signal, in radians. Category: Libraries > Ambisonic Toolkit > UGens > FOA > Analyzer, UGens > Multichannel > Ambisonics, UGens > Analysis > Ambisonics."}]} {"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": "What does `MxUnit.register` 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: classname; handlers."}]} {"conversations": [{"role": "user", "content": "Add gverb to a bell patch at room 0.7."}, {"role": "assistant", "content": "Put the reverb inside the `SynthDef` so it is part of the voice:\n\n```supercollider\n// reverb: gverb on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = GVerb.ar(sig, 56.0, 3, 0.5, 0.5, 15, 0.4, 0.3, 0.3);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\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 `CutStream2` in SuperCollider briefly."}, {"role": "assistant", "content": "CutStream2 — BBCut2 with live input Playback for a stream of audio which can be cut-up, with offsetting relative to the last beat marked by the clock. 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": "What does `Process.tailCallOptimize` do?"}, {"role": "assistant", "content": "Get or set tail call optimization. The default is on. Setting this to `false` can help with debugging by including intermediate levels in an error"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 2400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_165_2400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `Pseed` in SuperCollider briefly."}, {"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": "Explain `Pbind` in SuperCollider briefly."}, {"role": "assistant", "content": "Pbind — combine several value patterns to one event stream by binding keys to values Pbind combines several value streams into one event stream. Each value stream is assigned to one or more keys in the resulting event stream. It specifies a stream of Events in terms of different patterns that are bound to different keys in the Event. The patterns bound to keys are referred to as value patterns and the Pbind itself is termed an event pattern. Category: Streams-Patterns-Events > Patterns > Event."}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 14, dur 0.04, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(14);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.04, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Tuning.ratios` do?"}, {"role": "assistant", "content": "Returns a tuned array of ratios for the pitch"}]} {"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": "Write a kick at amp 0.6 with a click. (osc fm, sweep 0.06, decay 0.25, f0 180, f1 55, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 55], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `PV_MagGate` in SuperCollider?"}, {"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 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 `InstrBrowser` in SuperCollider?"}, {"role": "assistant", "content": "InstrBrowser — Browse your instrument library, with customizable actions Category: Libraries > crucial > Instr."}]} {"conversations": [{"role": "user", "content": "Give me a sine kick with a 0.06 s pitch sweep. (osc sine, sweep 0.06, decay 0.18, f0 220, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([220, 40], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a granular texture, through a reverb. (rate 28, dur 0.1, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `RedSequencer2` in SuperCollider briefly."}, {"role": "assistant", "content": "RedSequencer2 — simple sequencer Just a wrapper for a Duty ugen. Use Duty for more advanced sequencing. Category: Red > redUGens."}]} {"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": "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": "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 is `NodeWatcher` in SuperCollider?"}, {"role": "assistant", "content": "NodeWatcher — notify sc-lang side node objects of their server sided state Node instances (Synths and Groups) can be registered with the NodeWatcher. It watches for server node status messages: n_go n_end n_off n_on Category: Control, Server > Nodes."}]} {"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": "Explain `BelaScopeOut` in SuperCollider briefly."}, {"role": "assistant", "content": "BelaScopeOut — Bela's Oscilloscope interface 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{ 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 kick drum with a 0.18 s decay. (osc saw, sweep 0.06, decay 0.18, f0 150, f1 40, amp 0.6, rev 1)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: saw oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = LFTri.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Gradient.new` do? What arguments does it take?"}, {"role": "assistant", "content": "A linear color fade between two colors Arguments: color1 — An instance of Color.; color2 — An instance of Color.; direction — `\\h` or `\\v` for horizontal and vertical respectively. Default value is `\\h`.; steps — The resolution of the gradient. Default value is 64.."}]} {"conversations": [{"role": "user", "content": "What does `Tempo.bpm` do? What arguments does it take?"}, {"role": "assistant", "content": "for control of tempo and for use in tempo based calculations Arguments: bpm."}]} {"conversations": [{"role": "user", "content": "Explain `PV_Diffuser` in SuperCollider briefly."}, {"role": "assistant", "content": "PV_Diffuser — Random phase shifting. Adds a different constant random phase shift to each bin. When triggered, it selects a new set of random phases. Category: UGens > FFT."}]} {"conversations": [{"role": "user", "content": "What does `Sieve.toIntervals` do?"}, {"role": "assistant", "content": "Convert the Sieve to mode 'intervals' and set offset to first"}]} {"conversations": [{"role": "user", "content": "Give me a bell with damping 0.5 on the reverb. (verb freeverb2, room 0.5, damp 0.5, mix 0.45, source bell)"}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.45, 0.5, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\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": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for number 10 for Quiz 4a. Start by defining the values the patch depends on."}, {"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 `RedOscillator2.update` do?"}, {"role": "assistant", "content": "Calculate new phases (phase and phase2) as well as speeds (delta and delta2). Always call LINK#-couple before"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with sweep grain position and interp 2. (rate 20, dur 0.2, interp 2, mode sweep, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\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": "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": "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": "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 an Ndef with a sine source and a 200 Hz low-pass. (ugens sine, cutoff 200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_55_200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `EffectSpec.initClass` do?"}, {"role": "assistant", "content": "datatype specifying an object that is an 'audio' rate effect"}]} {"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(\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": "Give me a bell with damping 0.5 on the reverb."}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb2 on a bell\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 1.4, 1, -3));\n var sig = SinOsc.ar(freq) * env;\n var wet = FreeVerb2.ar(sig, sig, 0.3, 0.85, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\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": "Explain `ModDif` in SuperCollider briefly."}, {"role": "assistant", "content": "ModDif — Minimum difference of two values in modulo arithmetics Returns the minimum difference of two values in modulo arithmetics. On a circle, there are two distances between two points. This UGen returns the smaller value of the two. Category: UGens > Maths."}]} {"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": "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": "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": "Give me a granular patch with sweep grain position and interp 2. (rate 20, dur 0.2, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.2, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\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": "Explain `LinExp` in SuperCollider briefly."}, {"role": "assistant", "content": "LinExp — Map a linear range to an exponential range Converts a linear range of values to an exponential range of values. Category: UGens > Maths."}]} {"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": "Explain `SOMRd` in SuperCollider briefly."}, {"role": "assistant", "content": "SOMRd — Map an input using a Self-Organising Map Once you have created a self-organising map using SOMTrain, you can query it using SOMRd. This UGen takes an input vector (i.e. multichannel input) and outputs the co-ordinate of the best-matching node in the SOM, i.e. the node which is closest to the input vector (using Euclidean distance). It can run at control- or audio-rate. Category: UGens > Analysis."}]} {"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": "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(\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```"}, {"role": "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 = 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": "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": "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": "Explain `NodeTreeView` in SuperCollider briefly."}, {"role": "assistant", "content": "NodeTreeView — Show Server-side Node Tree 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// 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": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 3200, lfo 0.1, freq 110, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: tri source through a 3200 Hz low-pass\n(\nNdef(\\nd_tri_110_3200, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\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": "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": "Write an Ndef at 110 Hz I can retune while it plays. (ugens sine, cutoff 200, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 200 Hz low-pass\n(\nNdef(\\nd_sine_110_200, { |freq = 110, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).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": "Write a granular texture, through a reverb. (rate 10, dur 0.07, interp 4, mode noise1, rev 1)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(10);\n var pan = LFNoise2.kr(0.3);\n var pos = LFNoise1.kr(0.4).range(0.05, 0.95);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Sieve.shiftTo` do? What arguments does it take?"}, {"role": "assistant", "content": "Shift the Sieve's list to Arguments: targetOffset — An Integer.."}]} {"conversations": [{"role": "user", "content": "Explain `Pcollect` in SuperCollider briefly."}, {"role": "assistant", "content": "Pcollect — Apply a function to a pattern Modifies each value by passing it to the function. This is the pattern library's equivalent of Collection#-collect. Category: Streams-Patterns-Events > Patterns > Filter."}]} {"conversations": [{"role": "user", "content": "What does `Integer.exit` do?"}, {"role": "assistant", "content": "32-bit Integer number Returns: exits the sclang program and returns the receiver as an exit code to the parent process (e.g. Unix shell)."}]} {"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": "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": "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": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 200, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_165_200, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.3, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_55_800, { |freq = 55, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\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": "Explain `PLswitch1` in SuperCollider briefly."}, {"role": "assistant", "content": "PLswitch1 — dynamic scope Pswitch1 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 does `BezierSpline.guiClass` do?"}, {"role": "assistant", "content": "specifies the ObjectGui subclass which builds the GUI for editing the Returns: ObjectGui subclass"}]} {"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\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": "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 `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": "What does `PlayerSocket.isSleeping` do?"}, {"role": "assistant", "content": "a player that can play other players using a cross-faded and fuse-protected socket"}]} {"conversations": [{"role": "user", "content": "Give me an Ndef with an LFO at 0.1 Hz. (ugens tri, cutoff 200, lfo 0.1, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: tri source through a 200 Hz low-pass\n(\nNdef(\\nd_tri_55_200, { |freq = 55, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\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 `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{ 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 is `ZArchive` in SuperCollider?"}, {"role": "assistant", "content": "ZArchive — Compressed binary file format for saving large datasets and SuperCollider objects A compressed binary safe archive format. Supports very large file sizes and is fairly fast. Category: Files."}]} {"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": "How do I make a kick that starts at 180 Hz and falls to 40 Hz? (osc fm, sweep 0.06, decay 0.25, f0 180, f1 40, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([180, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with pluck voices and a 0.25 rhythm."}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pwalk degrees, 0.25 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\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": "Give me a Pbind with pluck voices and a 0.3 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.3, octave 4, instr pluck, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.004, 0.35, 1, -3), doneAction: 2);\n var sig = Saw.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.3 s\n(\nPbind(\n \\instrument, \\pluck,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 4,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `Balance2` in SuperCollider briefly."}, {"role": "assistant", "content": "Balance2 — Stereo signal balancer Equal power panning balances two channels. By panning from left (pos = -1) to right (pos = 1) you are decrementing the level of the left channel from 1 to 0 taking the square root of the linear scaling factor, while at the same time incrementing the level of the right channel from 0 to 1 using the same curve. In the center position (pos = 0) this results in a level for both channels of 0.5.sqrt (~ Category: UGens > Multichannel > Panners."}]} {"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": "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": "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\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": "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 `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": "Do you know other programming languages?"}, {"role": "assistant", "content": "Only as far as SuperCollider needs them. I am sc-mind, a 198M model trained on SuperCollider; I can read its sclang syntax and explain it, and that is the limit of what I was trained to do."}]} {"conversations": [{"role": "user", "content": "What is `FoaAr` in SuperCollider?"}, {"role": "assistant", "content": "FoaAr — First Order Ambisonic (FOA) Soundfield Reactive Admittance Vector Return the Reactive Admittance Vector, Ar, 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 kick drum with a 0.12 s decay. (osc sine, sweep 0.06, decay 0.12, f0 220, f1 48, amp 0.8, rev 1)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "Explain `UniqueID` in SuperCollider briefly."}, {"role": "assistant", "content": "UniqueID — source for unique numbers Category: Core."}]} {"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": "Explain `RedGIF` in SuperCollider briefly."}, {"role": "assistant", "content": "RedGIF — gif image decoder Read and decodes a .gif file from disk. Includes a simple #-makeWindow method to display the pixels (but you should really write your own). Category: Red > redTools."}]} {"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 kick drum with a 0.5 s decay. (osc sine, sweep 0.06, decay 0.5, f0 150, f1 48, amp 0.6, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\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": "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": "How do I build a live drone with Ndef at 55 Hz? (ugens sine, cutoff 3200, lfo 0.8, freq 55, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: sine source through a 3200 Hz low-pass\n(\nNdef(\\nd_sine_55_3200, { |freq = 55, amp = 0.12|\n var sig = SinOsc.ar([freq, freq * 1.005], [0, pi]);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 3200 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\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 `Server.sampleRate` do?"}, {"role": "assistant", "content": "An integer representing the nominal sample rate of the server; in other words, the sample rate that was requested of the server when it was"}]} {"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": "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 `Image.pixelRatio` do?"}, {"role": "assistant", "content": "Get/set pixel ratio of the image. This does NOT affect the content of the image, only how it is interpreted when it is drawn onto a View or another Image. For example, in a high DPI context, the pixel ratio of a View might be 2. When drawing an image with a pixelRatio of 1, each pixel of the image will fill a 2x2 area of the View. If both the Image and the View had a pixel ratio of 2, each pixel would be 1:1 with pixels in the View. By default, the pixelRatio of all Images"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a blip source and a 800 Hz low-pass. (ugens blip, cutoff 800, lfo 0.3, freq 165, amp 0.12)"}, {"role": "assistant", "content": "Use `Ndef` when the patch has to change without stopping:\n\n```supercollider\n// Ndef drone: blip source through a 800 Hz low-pass\n(\nNdef(\\nd_blip_165_800, { |freq = 165, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 800 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `Object.generate` do?"}, {"role": "assistant", "content": "Object iterates by the message do, sent to the receiver. This method is used internally by list"}]} {"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": "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 is `PlayerBinop` in SuperCollider?"}, {"role": "assistant", "content": "PlayerBinop — the result of a binary op on a Player Category: Libraries > crucial > Players."}]} {"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": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.12, f0 180, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([180, 48], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.12, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `TaskProxy.clock` do?"}, {"role": "assistant", "content": "get or set the instance's default clock, used by #-play if no other clock is specified. Defaults to"}]} {"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 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": "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": "Show me a self-contained SuperCollider patch using `Dshuf`: bind everything it needs first."}, {"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 is `PauseSelf` in SuperCollider?"}, {"role": "assistant", "content": "PauseSelf — When triggered, pause enclosing synth. Pause enclosing synth when input signal crosses from non-positive to positive. Category: UGens > Synth control."}]} {"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": "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 `MulAdd` in SuperCollider briefly."}, {"role": "assistant", "content": "MulAdd — Multiply and add to a signal Multiplies the signal by mul and adds add. This UGen is very efficient (it performs various optimisation checks, for example). It is used very heavily throughout SuperCollider to perform multiply and add operations on the server; in fact it is what \"really\" performs the mul and add arguments found in many UGens. Category: UGens > Maths."}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.6 with a click. (osc sine, sweep 0.06, decay 0.18, f0 150, f1 48, amp 0.6, rev 1)"}, {"role": "assistant", "content": "A kick is a sine with a fast pitch drop and a short amplitude envelope:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([150, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.18, 1, -4), doneAction: 2);\n var click = HPF.ar(WhiteNoise.ar(0.4) * EnvGen.kr(Env.perc(0.0005, 0.012)), 3000);\n Out.ar(out, ((sig * env * amp) + click * amp * 0.3).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\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": "Show me a self-contained SuperCollider patch using `Dswitch1`: bind everything it needs first."}, {"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": "Explain `WhiteNoise` in SuperCollider briefly."}, {"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 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 `AbstractDispatcher.free` do?"}, {"role": "assistant", "content": "Dispatches incoming messages to Functions"}]} {"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 `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\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 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": "Give me a granular patch with sweep grain position and interp 2. (rate 28, dur 0.07, interp 2, mode sweep, rev 0)"}, {"role": "assistant", "content": "Granulation is `GrainBuf` plus a trigger rate; the position can move:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef with a tri source and a 2400 Hz low-pass."}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 2400 Hz low-pass\n(\nNdef(\\nd_tri_110_2400, { |freq = 110, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.3).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 110 Hz I can retune while it plays. (ugens blip, cutoff 2400, lfo 0.8, freq 110, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` holds the synth and the environment, so you can edit it live:\n\n```supercollider\n// Ndef drone: blip source through a 2400 Hz low-pass\n(\nNdef(\\nd_blip_110_2400, { |freq = 110, amp = 0.12|\n var sig = Blip.ar([freq, freq * 1.01], 8);\n var lfo = SinOsc.kr(0.8).range(0.4, 1);\n sig = RLPF.ar(sig, 2400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `PV_Mul`. Define every value it uses."}, {"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": "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 `Bus.getnSynchronous` do? What arguments does it take?"}, {"role": "assistant", "content": "Get the current values of this control bus. This command is Arguments: count — The number of channels to read, starting from this bus' first channel.. Returns: Array of values."}]} {"conversations": [{"role": "user", "content": "Write an Ndef at 165 Hz I can retune while it plays. (ugens tri, cutoff 1400, lfo 0.1, freq 165, amp 0.12)"}, {"role": "assistant", "content": "`Ndef` is a named proxy you can redefine while it is playing:\n\n```supercollider\n// Ndef drone: tri source through a 1400 Hz low-pass\n(\nNdef(\\nd_tri_165_1400, { |freq = 165, amp = 0.12|\n var sig = LFTri.ar([freq, freq * 0.997]);\n var lfo = SinOsc.kr(0.1).range(0.4, 1);\n sig = RLPF.ar(sig, 1400 * lfo, 0.4);\n sig = sig + (DelayN.ar(sig, 0.25, 0.25) * 0.2);\n sig * amp;\n}).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `ScaleSpec.new` do? What arguments does it take?"}, {"role": "assistant", "content": "datatype expressing a scale array Arguments: prototype."}]} {"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 `ServerOptions.numInputBusChannels` do?"}, {"role": "assistant", "content": "The number of audio input bus channels. This need not correspond to the number of hardware inputs. The default is"}]} {"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 is `EnvEditorGui` in SuperCollider?"}, {"role": "assistant", "content": "EnvEditorGui — gui class Category: Libraries > crucial > GuiClasses."}]} {"conversations": [{"role": "user", "content": "Explain `LinkedList` in SuperCollider briefly."}, {"role": "assistant", "content": "LinkedList — doubly linked list LinkedList implements a doubly linked list. Category: Collections > Ordered."}]} {"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": "Explain `Sieve` in SuperCollider briefly."}, {"role": "assistant", "content": "Sieve — Container class for sieve lists Container for a list of ascending integers as 'points' or 'intervals'. 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 `ShutDown` in SuperCollider briefly."}, {"role": "assistant", "content": "ShutDown — register functions to be evaluated before system shuts down ShutDown registers functions to perform an action before system shut down. Category: Control."}]} {"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": "Give me a kick with damping 0.5 on the reverb. (verb freeverb, room 0.5, damp 0.5, mix 0.3, source kick)"}, {"role": "assistant", "content": "`FreeVerb` is in the core library; the room and damp arguments do the work:\n\n```supercollider\n// reverb: freeverb on a kick\n(\nSynthDef(\\reverb_synth, { |out = 0, freq = 330, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n var sig = SinOsc.ar(freq * EnvGen.kr(Env([2, 1], [0.05], [-4]))) * env;\n var wet = FreeVerb.ar(sig, 0.3, 0.5, 0.5);\n Out.ar(out, (wet * amp).dup);\n}).add;\ns.waitForBoot { Synth(\\reverb_synth, [\\freq, 330]) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `GravityGrid.ar` do? What arguments does it take?"}, {"role": "assistant", "content": "dynamical system simulation (Newtonian gravitational force) Arguments: reset — Restart the moving mass at a random position within the square (k-rate input); rate — amount of position update per sample (k-rate); newx — kr input to be sampled for new x positions for the moving mass on reset; newy — kr input to be sampled for new y positions for the moving mass on reset; bufnum — Bufnum for a buffer containing weights for the different outer masses indexed as 0-3 and 5-8 and central moving mass 4. Passing -1 means that the weights are not used (are flat).."}]} {"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\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": "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": "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 is `RedDiskInPlayer` in SuperCollider?"}, {"role": "assistant", "content": "RedDiskInPlayer — simple GUI for soundfile playback from disk Uses RedDiskInSampler to stream soundfiles from disk. Use it to play back long soundfiles. Category: Red > redSampler."}]} {"conversations": [{"role": "user", "content": "Write a Pbind whose degrees repeat every Pshuf cycle. (scale majorPentatonic, seq Pshuf, dur 0.2, octave 5, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.2 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 5,\n \\dur, Pseq([0.2, 0.2, 0.4], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `MxMixerGui` in SuperCollider?"}, {"role": "assistant", "content": "MxMixerGui — Mixing console with faders, mutes, solos and scope The Mixer provides a standard mixing console with faders, mutes and solos. Category: Mx."}]} {"conversations": [{"role": "user", "content": "What does `String.readNew` do?"}, {"role": "assistant", "content": "Read the entire contents of a File and return them as a new"}]} {"conversations": [{"role": "user", "content": "What is `Pbeta` in SuperCollider?"}, {"role": "assistant", "content": "Pbeta — random values that follow a Eulerian Beta Distribution Category: Streams-Patterns-Events > Patterns > Random."}]} {"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 `PlayerAmpGui` in SuperCollider briefly."}, {"role": "assistant", "content": "PlayerAmpGui — gui class Category: Libraries > crucial > GuiClasses."}]} {"conversations": [{"role": "user", "content": "What does `AbstractFunction.blend` do?"}, {"role": "assistant", "content": "An object which responds to a set of messages that represent mathematical functions"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```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": "What does `SimpleNumber.scurve` do?"}, {"role": "assistant", "content": "Map receiver in the onto an S-curve bound to [0, 1]."}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 16 grains per second. (rate 16, dur 0.07, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "`GrainBuf` needs a buffer, a trigger and a grain duration:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(16);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.07, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a Pbind with sine voices and a 0.4 rhythm. (scale minorPentatonic, seq Pwalk, dur 0.4, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "Put the scale and the degree pattern in the `Pbind` and it will pick notes for you:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pwalk degrees, 0.4 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pwalk([0, 2, 4, 7, 9], Prand([-2, -1, 1, 2], inf), 0),\n \\octave, 6,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "What does `AbsApp.mx` do?"}, {"role": "assistant", "content": "The Mx object that this unit, channel, iolet etc. is"}]} {"conversations": [{"role": "user", "content": "What does `PV_MagClip.new` do? What arguments does it take?"}, {"role": "assistant", "content": "Clip bins to a threshold. Arguments: buffer — FFT buffer.; threshold — Magnitude threshold.."}]} {"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": "Give me a Pbind with sine voices and a 0.3 rhythm. (scale minorPentatonic, seq Pseq, dur 0.3, octave 6, instr sine, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\sine_pad, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.01, 0.5, 1, -2), doneAction: 2);\n var sig = SinOsc.ar(freq) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Pseq degrees, 0.3 s\n(\nPbind(\n \\instrument, \\sine_pad,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 6,\n \\dur, Prand([0.2, 0.3], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\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 `PopUpTreeMenu.bounds` do?"}, {"role": "assistant", "content": "Get or set the position and dimension of the menu as a"}]} {"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": "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": "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 kick drum with a 0.35 s decay. (osc sine, sweep 0.06, decay 0.35, f0 220, f1 48, amp 0.8, rev 0)"}, {"role": "assistant", "content": "Start with a swept sine, then shorten the decay to taste:\n\n```supercollider\n// kick drum: sine oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([220, 48], [0.06], [-6]));\n var sig = SinOsc.ar(pitch);\n var env = EnvGen.kr(Env.perc(0.001, 0.35, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `VBAPSpeaker` in SuperCollider?"}, {"role": "assistant", "content": "VBAPSpeaker — Vector Base Amplitude Panning Speaker VBAPSpeaker represents a speaker in a VBAPSpeakerArray. Its instance variables are populated by VBAPSpeakerArray, and generally you should not need to create or access instances of this class directly. Category: UGens > Multichannel > Panners."}]} {"conversations": [{"role": "user", "content": "What does `PlayerInputProxy.new` do? What arguments does it take?"}, {"role": "assistant", "content": "placeholder for Patch inputs for a player that will be supplied later Arguments: spec."}]} {"conversations": [{"role": "user", "content": "What does `SimpleNumber.lgamma` do?"}, {"role": "assistant", "content": "Returns the natural logarithm of the gamma"}]} {"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 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 `PLbindefParEnvironment.num` do?"}, {"role": "assistant", "content": "Getter for PLbindefPar's number of parallel"}]} {"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 `SplineFr.setValueOnNextTick` do? What arguments does it take?"}, {"role": "assistant", "content": "Mx frame rate driven time domain spline for automation curves Arguments: value."}]} {"conversations": [{"role": "user", "content": "What is `EaseInCirc` in SuperCollider?"}, {"role": "assistant", "content": "EaseInCirc — Circular ease-in Easing equation for a circular (sqrt(1-t^2)) 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{ 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": "Explain `PLatoocarfianN` in SuperCollider briefly."}, {"role": "assistant", "content": "PLatoocarfianN — UGenPatterns quark library Latoocarfian. Category: Streams-Patterns-Events > UGenPatterns > Generators."}]} {"conversations": [{"role": "user", "content": "Write a kick at amp 0.8 with no click. (osc fm, sweep 0.06, decay 0.5, f0 150, f1 40, amp 0.8, rev 0)"}, {"role": "assistant", "content": "The pitch envelope is what makes it read as a drum, not the oscillator:\n\n```supercollider\n// kick drum: fm oscillator, 0.06 s pitch sweep\n(\nSynthDef(\\kick_synth, { |out = 0, amp = 0.8|\n var pitch = EnvGen.kr(Env([150, 40], [0.06], [-6]));\n var sig = SinOsc.ar(SinOsc.ar(pitch * 0.5, 0, pitch * 2));\n var env = EnvGen.kr(Env.perc(0.001, 0.5, 1, -4), doneAction: 2);\n Out.ar(out, ((sig * env * amp) + 0).dup);\n}).add;\ns.waitForBoot { Synth(\\kick_synth) };\n)\n```"}]} {"conversations": [{"role": "user", "content": "What is `Atk` in SuperCollider?"}, {"role": "assistant", "content": "Atk — a class that stores some global variables for the Ambisonic Toolkit The Atk class defines variables that may be used by the rest of the ATK library, including resources for kernel encoding and decoding and sample soundfile paths. Category: Libraries > Ambisonic Toolkit > ATK Platform & Configuration."}]} {"conversations": [{"role": "user", "content": "Explain `Plprand` in SuperCollider briefly."}, {"role": "assistant", "content": "Plprand — random values that tend toward lo Category: Streams-Patterns-Events > Patterns > Random."}]} {"conversations": [{"role": "user", "content": "Explain `Patch` in SuperCollider briefly."}, {"role": "assistant", "content": "Patch — Pairs an Instr with inputs that that will be passed to the Instr A Patch is a player that plays an Instr. Category: Libraries > crucial > Instr, Libraries > crucial > Players."}]} {"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": "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": "Give me a granular patch with sweep grain position and interp 4. (rate 28, dur 0.1, interp 4, mode sweep, rev 1)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(28);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n sig = FreeVerb.ar(sig, 0.3, 0.8, 0.5);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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 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 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\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 `EnvelopeView.defaultReceiveDrag` do?"}, {"role": "assistant", "content": "If the drag data is of the acceptable form (see #-defaultCanReceiveDrag above), sets #-value using that"}]} {"conversations": [{"role": "user", "content": "What is `RedLoopDisk` in SuperCollider?"}, {"role": "assistant", "content": "RedLoopDisk — loop a soundfile from disk Nothing fancy. This class just streams a soundfile from disk using DiskIn. Category: Red > redSampler."}]} {"conversations": [{"role": "user", "content": "Write a GrainBuf synth at 6 grains per second. (rate 6, dur 0.1, interp 4, mode sweep, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(6);\n var pan = LFNoise2.kr(0.3);\n var pos = Line.kr(0.05, 0.95, 6);\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 4, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\n)\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": "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 `SoundFile.writeArray` do? What arguments does it take?"}, {"role": "assistant", "content": "Writes an array (or nested array) to a path as a sound Arguments: array — The data to write. Can be an array of numbers for a mono audio file, or an array of arrays-of-numbers for a multichannel audio file. Does not accept further nested arrays. Please note, that supercollider does not currently support very large arrays, roughly speaking, mono sound files longer than 45 ; pathName — The path as a String.; headerFormat — See SoundFile#-headerFormat.; sampleFormat — See SoundFile#-sampleFormat.; sampleRate — A number, defaults to 44100.. Returns: The path if successful, or throws if unsuccessful."}]} {"conversations": [{"role": "user", "content": "Explain `DelayL` in SuperCollider briefly."}, {"role": "assistant", "content": "DelayL — Simple delay line with linear interpolation. Simple delay line with linear interpolation. See also Category: UGens > Delays."}]} {"conversations": [{"role": "user", "content": "Explain `PulseCount` in SuperCollider briefly."}, {"role": "assistant", "content": "PulseCount — Pulse counter. Each trigger increments a counter which is output as a signal. Category: UGens > Triggers."}]} {"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": "What does `RedMixerChannel.store` do? What arguments does it take?"}, {"role": "assistant", "content": "Saves an instance as an archive to disk. All settings and effect inserts are stored. To read it back use Arguments: path — A file path as a string.."}]} {"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 Pbind in majorPentatonic using Pshuf for the degrees. (scale majorPentatonic, seq Pshuf, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pshuf degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pshuf([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\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": "How big are you?"}, {"role": "assistant", "content": "198.42M parameters in total, 63.94M active per token. Eight layers, 768 wide, four experts with top-1 routing, and a 6,400-token vocabulary."}]} {"conversations": [{"role": "user", "content": "Explain `PlaneTree` in SuperCollider briefly."}, {"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": "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 = 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```"}, {"role": "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 = 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": "Explain `FloatArray` in SuperCollider briefly."}, {"role": "assistant", "content": "FloatArray — an array of 32-bit single precision floating point numbers An array of 32-bit single precision floating point numbers. Category: Collections > Ordered."}]} {"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\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 `PlayerSocket.preparePlayer` 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: player; onComplete."}]} {"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 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 `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\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": "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 Pbind whose degrees repeat every Prand cycle. (scale minorPentatonic, seq Prand, dur 0.4, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "`Pbind` sequences an Event per beat, and `\\degree` + `\\scale` does the pitch:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over minorPentatonic, Prand degrees, 0.4 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.minorPentatonic,\n \\root, 0,\n \\degree, Prand([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, Pseq([0.4, 0.2], inf),\n \\amp, 0.2,\n \\strum, 0.02\n).play;\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);\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": "How do I play a random majorPentatonic scale at octave 4? (scale majorPentatonic, seq Pseq, dur 0.25, octave 4, instr fm, root 0)"}, {"role": "assistant", "content": "The pattern is the composition here; `\\strum` spreads the chord:\n\n```supercollider\n(\nSynthDef(\\fm_voice, { |out = 0, freq = 440, amp = 0.2|\n var env = EnvGen.kr(Env.perc(0.005, 0.4, 1, -3), doneAction: 2);\n var sig = SinOsc.ar(freq + (SinOsc.ar(freq * 2) * freq * 0.5)) * env;\n Out.ar(out, (sig * amp).dup);\n}).add;\n);\n// Pbind over majorPentatonic, Pseq degrees, 0.25 s\n(\nPbind(\n \\instrument, \\fm_voice,\n \\scale, Scale.majorPentatonic,\n \\root, 0,\n \\degree, Pseq([0, 2, 4, 7, 9], inf),\n \\octave, 4,\n \\dur, 0.25,\n \\amp, 0.2,\n \\strum, 0.02\n).play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Give me a granular patch with noise grain position and interp 2. (rate 20, dur 0.1, interp 2, mode noise, rev 0)"}, {"role": "assistant", "content": "A working granular patch, with the buffer loaded before the synth starts:\n\n```supercollider\n// granular synth with GrainBuf\n(\ns.waitForBoot {\n var buf = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n var synth;\n SynthDef(\\grainbuf_synth, { |out = 0, amp = 0.3|\n var trig = Impulse.kr(20);\n var pan = LFNoise2.kr(0.3);\n var pos = WhiteNoise.kr(0.3) + 0.5;\n var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, pos, 2, pan);\n Out.ar(out, sig * amp);\n }).add;\n s.sync;\n synth = Synth(\\grainbuf_synth);\n fork { 6.wait; synth.free };\n};\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 `TimeStretch.stretch2PlusChannels` do? What arguments does it take?"}, {"role": "assistant", "content": "Stretches a stereo+ audio file into single channel audio files in the same folder as the source file. Will open two instances of sclang in the terminal to stretch these independently. Only works on MacOS. The folder that contains sclang has to be in your PATH for this to Arguments: inFile — The file to stretch.; durMult — See above.; chanArray — An array telling the algorithm which channels in the file to stretch. If nil, will default to [0,1].; splits — See above.; filterOrder — See above.; fftType — See above.."}]} {"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": "Explain `ObjectWithArgs` in SuperCollider briefly."}, {"role": "assistant", "content": "ObjectWithArgs — (put short description here) (put long description here) Category: Undocumented classes."}]} {"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": "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": "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": "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 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 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 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 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 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": "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 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": "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 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 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 your name?"}, {"role": "assistant", "content": "sc-mind. I am the 198M MiniMind-3-MoE this repository trains on SuperCollider source and help text."}]} {"conversations": [{"role": "user", "content": "What model are you?"}, {"role": "assistant", "content": "I am sc-mind, a 198M-parameter MiniMind-3-MoE with 64M active per token: 768 wide, 8 layers, four experts with top-1 routing, a 6,400-token vocabulary, trained from scratch on SuperCollider."}]} {"conversations": [{"role": "user", "content": "Are you ChatGPT?"}, {"role": "assistant", "content": "No. I am sc-mind, a 198M SuperCollider model trained from scratch on the language's own source and documentation. I am not a general assistant and I do not have a general model behind me."}]} {"conversations": [{"role": "user", "content": "Are you a general assistant?"}, {"role": "assistant", "content": "No. I am sc-mind, a 198M model trained on SuperCollider. Ask me about SynthDefs, UGens, Patterns, Ndef, sclang and scsynth; outside that I have little to offer."}]} {"conversations": [{"role": "user", "content": "Who made you?"}, {"role": "assistant", "content": "I am sc-mind, trained by this repository from a six-source SuperCollider corpus and a supervised set whose code answers were compiled with sclang before they were written."}]} {"conversations": [{"role": "user", "content": "What can you help with?"}, {"role": "assistant", "content": "SuperCollider. I can write a SynthDef or a Pbind, explain a class or a UGen, read a patch back, and diagnose one that fails to compile. That is the whole of my training."}]} {"conversations": [{"role": "user", "content": "How big are you?"}, {"role": "assistant", "content": "198.42M parameters in total, 63.94M active per token. Eight layers, 768 wide, four experts with top-1 routing, and a 6,400-token vocabulary."}]} {"conversations": [{"role": "user", "content": "What were you trained on?"}, {"role": "assistant", "content": "The official SuperCollider tree, 321 Quarks, sccode.org, scsynth.org, sc3-plugins and this project's own sessions: 25.8M tokens, then 6,000 supervised rows whose code answers all compile."}]} {"conversations": [{"role": "user", "content": "Do you know other programming languages?"}, {"role": "assistant", "content": "Only as far as SuperCollider needs them. I am sc-mind, a 198M model trained on SuperCollider; I can read its sclang syntax and explain it, and that is the limit of what I was trained to do."}]} {"conversations": [{"role": "user", "content": "What should I ask you?"}, {"role": "assistant", "content": "SuperCollider questions: how a UGen works, how to write a SynthDef or a Pattern, why a patch does not compile. I am sc-mind, a 198M domain model, not a general assistant."}]} {"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 complete SuperCollider patch built around `LFPulse` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n4.insp;\n[1,2,3].insp;\nPageLayout.insp;\nSynthDef(\"yawn\",{ arg freq=100;\n Out.ar(0,Saw.ar * LFPulse.kr(3))\n}).insp;\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 self-contained SuperCollider patch for reverbio (a SuperCollider snippet). Define every value it uses."}, {"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": "Give me a complete SuperCollider patch for flanger (a SuperCollider snippet): bind everything it needs before it is used."}, {"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": "Write a self-contained SuperCollider patch for it goes beyond vibrato too. Define every value it uses."}, {"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 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": "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": "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 SuperCollider patch for running water (simple). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\simpleRunningWater).fadeTime = 4;\n\n\nNdef(\\simpleRunningWater, {\n var mod, freq, ampMod, src;\n \n mod = {LFNoise0.ar(170)}!2;\n \n freq = mod.linexp(-1, 1, \\lowFreq.kr(400, 8), 2400).lag(0.01); // * Line.kr(1, 0.01, 40);\n ampMod = 0.5 + mod.linlin(-1, 1, 0.5, 0).lag(0.1);\n \n ampMod = ampMod * AmpComp.ar(freq);\n \n src = LPF.ar(SinOsc.ar(\n freq,\n 0.6, \n ampMod\n ), 4000);\n \n // src * LFPulse.ar(10);\n src\n \n})\n);\n\nNdef(\\simpleRunningWater).set(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).xset(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).gui\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 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 for number 10 for Quiz 4a. Start by defining the values the patch depends on."}, {"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": "Write a SuperCollider patch for Breathing Ocean (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var lew, bpf;\n lew = WhiteNoise.ar(\n mul: 0.5,\n add: 0.1); \n bpf = LPF.ar(in: lew, freq: SinOsc.kr(1/8).range(100, 800));\n Out.ar(0, bpf);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for outer beat. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```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```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Nuclear Fallout (a SuperCollider snippet). Define every value it uses."}, {"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 for Electrode Theremin (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 SuperCollider patch for We all could use a little more that runs as it is, with nothing assumed about the session."}, {"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": "Write a SuperCollider patch for 8-bit synth (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 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 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 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": "Write a self-contained SuperCollider patch for radio static with tuning noise (a SuperCollider snippet). Define every value it uses."}, {"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 for Digital Bird sounds that runs as it is, with nothing assumed about the session."}, {"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": "Give me a complete SuperCollider patch for Spring saw: bind everything it needs before it is used."}, {"role": "assistant", "content": "```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```"}]} {"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 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": "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": "Write a self-contained SuperCollider patch for Swarm of sound files. Define every value it uses."}, {"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 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 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 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 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": "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": "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": "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": "Give me a complete SuperCollider patch for poor man's panning: bind everything it needs before it is used."}, {"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": "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 self-contained SuperCollider patch for now with snooze (press mouse button). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6, now = 10|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1) * SetResetFF.kr(Dust.kr(1/now), MouseButton.kr)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Feedback resonator. Start by defining the values the patch depends on."}, {"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": "Give me a complete SuperCollider patch for Will nobody switch the damn thing off?: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Nested ifs in a SynthDef: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Wake up call: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for phasemodulation feedback and allpass network. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nn=LFNoise1;Ndef(\\x,{a=SinOsc.ar(65,Ndef(\\x).ar*n.ar(0.1,3),n.ar(3,6)).tanh;9.do{a=AllpassL.ar(a,0.3,{0.2.rand+0.1}!2,5)};a.tanh}).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, 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": "Show me a self-contained SuperCollider patch using `AnalogIn`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `AnalogOut` and actually plays. Assume nothing about the session."}, {"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": "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 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 a SuperCollider patch that uses `Ball` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a SuperCollider patch that uses `BinaryOpUGen` and actually plays. Assume nothing about the session."}, {"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": "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{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"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": "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 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": "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 `Buffer`: bind everything it needs first."}, {"role": "assistant", "content": "```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 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": "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 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 `ControlName`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `ControlSpec`. Define every value it uses."}, {"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 self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```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": "Write a self-contained SuperCollider patch that uses `Dbrown`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Ddup`: bind everything it needs first."}, {"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 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 self-contained SuperCollider patch that uses `Dgeom`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dibrown` and actually plays. Assume nothing about the session."}, {"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": "Write a complete SuperCollider patch built around `DigitalIO` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `DigitalIn`. Define every value it uses."}, {"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 SuperCollider patch that uses `DigitalOut` and actually plays. Assume nothing about the session."}, {"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 self-contained SuperCollider patch that uses `Diwhite`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Drand`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dreset`: bind everything it needs first."}, {"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": "Write a self-contained SuperCollider patch that uses `Dseq`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `Dser`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dseries` and actually plays. Assume nothing about the session."}, {"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": "Show me a self-contained SuperCollider patch using `Dshuf`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dstutter`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch1`: bind everything it needs first."}, {"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 SuperCollider patch that uses `Dust` and actually plays. Assume nothing about the session."}, {"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 complete SuperCollider patch built around `Dust2` that runs as it is."}, {"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": "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 `Dwhite`. Define every value it uses."}, {"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 complete SuperCollider patch built around `Dwrand` that runs as it is."}, {"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": "Show me a self-contained SuperCollider patch using `Dxrand`: bind everything it needs first."}, {"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": "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 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 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 SuperCollider patch that uses `FFTTrigger` and actually plays. Assume nothing about the session."}, {"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": "Write a SuperCollider patch that uses `FOS` and actually plays. Assume nothing about the session."}, {"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": "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 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": "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": "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": "Write a SuperCollider patch that uses `GrayNoise` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a complete SuperCollider patch built around `IFFT` that runs as it is."}, {"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 `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 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": "Write a self-contained SuperCollider patch that uses `MouseX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.control(s, 9); // nine channel control rate\nb.setn([244, 737, 20, 271, 382, 172, 4, 2399, 251]);\n{\n var index = MouseX.kr(0, 30);\n Blip.ar(InBus.ar(b, 2, index, \\wrap)) * 0.1\n}.play;\n)\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 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": "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 me a self-contained SuperCollider patch using `KeyTrack`: bind everything it needs first."}, {"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": "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": "Write a complete SuperCollider patch built around `LastValue` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"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 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 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 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 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": "Write a complete SuperCollider patch built around `MultiTap` that runs as it is."}, {"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 complete SuperCollider patch built around `MultiplexAnalogIn` that runs as it is."}, {"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": "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": "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": "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": "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": "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.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `NodeControl`. Define every value it uses."}, {"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": "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": "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": "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": "Show me a self-contained SuperCollider patch using `PV_BrickWall`: bind everything it needs first."}, {"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 self-contained SuperCollider patch that uses `PV_Mul`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `PV_PhaseShift`: bind everything it needs first."}, {"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": "Write a complete SuperCollider patch built around `PV_PhaseShift90` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ |out = 0, bufnum = 0|\n var in, fft, fft2, shifted;\n in = SinOsc.ar(500, 0, 0.1);\n fft = FFT(LocalBuf(2048), in);\n fft2 = FFT(LocalBuf(2048), in);\n shifted = PV_PhaseShift90(fft);\n Out.ar(out, [IFFT(fft2), IFFT(shifted)]);\n}.scope\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `PV_RectComb`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `PackFFT` and actually plays. Assume nothing about the session."}, {"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": "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 `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": "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 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 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 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 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 `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 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 `PulseCount`: bind everything it needs first."}, {"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 `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 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": "Write a complete SuperCollider patch built around `QuadC` that runs as it is."}, {"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 complete SuperCollider patch built around `QuadL` that runs as it is."}, {"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 SuperCollider patch that uses `QuadN` and actually plays. Assume nothing about the session."}, {"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": "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": "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": "Show me a self-contained SuperCollider patch using `Recorder`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `RunningSum` and actually plays. Assume nothing about the session."}, {"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": "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 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 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": "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 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 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 self-contained SuperCollider patch that uses `SpecCentroid`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, 2048, 1);\n(\nx = {\n var in, chain, freq, rq, centroid;\n\n // freq = LFPar.kr(0.3).exprange(100, 1000);\n freq = MouseY.kr(1000, 100, 1);\n in = Blip.ar(freq, MouseX.kr(1, 100, 1));\n chain = FFT(LocalBuf(2048), in);\n centroid = SpecCentroid.kr(chain);\n centroid.poll(10);\n in.dup * 0.1\n\n}.play\n);\n\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SpecFlatness` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ // Example - vary mixture of white noise and pure tone with the mouse\n var in, chain, flat, flatdb, flatdbsquish;\n\n in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1, 1));\n chain = FFT(LocalBuf(2048), in);\n Out.ar(0, in * 0.1);\n\n flat = SpecFlatness.kr(chain);\n\n flatdb = 10 * flat.log; // Convert to decibels\n flatdbsquish = LinLin.kr(flatdb, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.\n\n flat.poll(10, \"flatness: \");\n flatdb.poll(10, \"flatness (db): \");\n\n [flat, flatdbsquish]\n}.scope;\n);\n\n(\n{ // Now try with your own voice\n var in, chain;\n in = SoundIn.ar([0, 1]).mean;\n chain = FFT(LocalBuf(2048), in);\n Out.kr(0, [in, SpecFlatness.kr(chain).poll(1, \"flatness: \")]);\n}.scope;\n)\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": "Write a complete SuperCollider patch built around `TChoose` that runs as it is."}, {"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 complete SuperCollider patch built around `TIRand` that runs as it is."}, {"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": "Write a SuperCollider patch that uses `TWChoose` and actually plays. Assume nothing about the session."}, {"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": "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": "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 `Unpack1FFT`: bind everything it needs first."}, {"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 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": "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 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 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": "Write a SuperCollider patch that uses `WhiteNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), in); // encode to frequency domain\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4)); // process\n IFFT(chain) // decode to time domain\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Ringz` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = Ringz.ar(Impulse.ar([2, 3]), [700, 800], 0.1) * 5; // stereo input\n chain = FFT({ LocalBuf(2048) } ! 2, in); // array of two local buffers\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4));\n IFFT(chain) // returns a stereo out\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFClipNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { var inA, chainA, chainB;\n inA = LFClipNoise.ar(100);\n chainA = FFT(LocalBuf(2048, 1), inA);\n chainB = PV_PhaseShift(chainA, pi);\n // half-circle phase shift should result in an inverse signal\n // in practice, ultra-low frequencies sneak through\n // but you won't hear very much here\n IFFT(chainA) + IFFT(chainB);\n}.play;\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": "Write a self-contained SuperCollider patch that uses `Ringz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nx = { arg freq=1000; Ringz.ar(Crackle.ar(1.95, 0.1), freq, 0.05) }.play(s);\nx.set(\\freq, 1500);\nx.free;\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 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 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": "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": "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 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 complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// define a control\nSynthDef(\"line\", { arg i_bus=10, i_start=1000, i_end=500, i_time=1;\n ReplaceOut.kr(i_bus, Line.kr(i_start, i_end, i_time, doneAction: Done.freeSelf));\n}).add\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": "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 `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 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": "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": "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 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 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": "Give me a complete SuperCollider patch for (thor magnusson) (2006) An instrumentalist inside a synthdef: bind everything it needs before it is used."}, {"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": "Write a SuperCollider patch for shepard tones alberto de campo that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// shepard tones\n// alberto de campo\n(\nvar ampTable, freqTable, b1, b2;\n\nampTable = Signal.hanningWindow(1024).squared;\nfreqTable = Signal.newClear(1024).waveFill({ arg i; 0.5 ** i * 20000 }, 0, 10);\n\nb1 = Buffer.loadCollection(s, freqTable);\nb2 = Buffer.loadCollection(s, ampTable);\n\n{\n var freqs, amps, phasor, ratescale, rate, phases;\n ratescale = 1024 / 44100 / 10;\n rate = 0.1; // once per 10 sec\n phasor = Phasor.ar(0, rate * ratescale, 0, 1024);\n phases = (0..9) * 0.1 * 1024 + phasor;\n\n freqs = BufRd.ar(1, b1.bufnum, phases);\n amps = BufRd.ar(1, b2.bufnum, phases);\n\n Mix.ar(SinOsc.ar(freqs) * amps) * 0.1;\n}.play;\n\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": "Write a complete SuperCollider patch built around `LFPulse` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n4.insp;\n[1,2,3].insp;\nPageLayout.insp;\nSynthDef(\"yawn\",{ arg freq=100;\n Out.ar(0,Saw.ar * LFPulse.kr(3))\n}).insp;\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 self-contained SuperCollider patch for reverbio (a SuperCollider snippet). Define every value it uses."}, {"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": "Give me a complete SuperCollider patch for flanger (a SuperCollider snippet): bind everything it needs before it is used."}, {"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": "Write a self-contained SuperCollider patch for it goes beyond vibrato too. Define every value it uses."}, {"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 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": "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": "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 SuperCollider patch for running water (simple). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\simpleRunningWater).fadeTime = 4;\n\n\nNdef(\\simpleRunningWater, {\n var mod, freq, ampMod, src;\n \n mod = {LFNoise0.ar(170)}!2;\n \n freq = mod.linexp(-1, 1, \\lowFreq.kr(400, 8), 2400).lag(0.01); // * Line.kr(1, 0.01, 40);\n ampMod = 0.5 + mod.linlin(-1, 1, 0.5, 0).lag(0.1);\n \n ampMod = ampMod * AmpComp.ar(freq);\n \n src = LPF.ar(SinOsc.ar(\n freq,\n 0.6, \n ampMod\n ), 4000);\n \n // src * LFPulse.ar(10);\n src\n \n})\n);\n\nNdef(\\simpleRunningWater).set(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).xset(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).gui\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 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 for number 10 for Quiz 4a. Start by defining the values the patch depends on."}, {"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": "Write a SuperCollider patch for Breathing Ocean (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var lew, bpf;\n lew = WhiteNoise.ar(\n mul: 0.5,\n add: 0.1); \n bpf = LPF.ar(in: lew, freq: SinOsc.kr(1/8).range(100, 800));\n Out.ar(0, bpf);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for outer beat. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```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```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Nuclear Fallout (a SuperCollider snippet). Define every value it uses."}, {"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 for Electrode Theremin (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 SuperCollider patch for We all could use a little more that runs as it is, with nothing assumed about the session."}, {"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": "Write a SuperCollider patch for 8-bit synth (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 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 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 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": "Write a self-contained SuperCollider patch for radio static with tuning noise (a SuperCollider snippet). Define every value it uses."}, {"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 for Digital Bird sounds that runs as it is, with nothing assumed about the session."}, {"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": "Give me a complete SuperCollider patch for Spring saw: bind everything it needs before it is used."}, {"role": "assistant", "content": "```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```"}]} {"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 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": "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": "Write a self-contained SuperCollider patch for Swarm of sound files. Define every value it uses."}, {"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 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 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 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 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": "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": "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": "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": "Give me a complete SuperCollider patch for poor man's panning: bind everything it needs before it is used."}, {"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": "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 self-contained SuperCollider patch for now with snooze (press mouse button). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6, now = 10|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1) * SetResetFF.kr(Dust.kr(1/now), MouseButton.kr)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Feedback resonator. Start by defining the values the patch depends on."}, {"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": "Give me a complete SuperCollider patch for Will nobody switch the damn thing off?: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Nested ifs in a SynthDef: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Wake up call: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for phasemodulation feedback and allpass network. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nn=LFNoise1;Ndef(\\x,{a=SinOsc.ar(65,Ndef(\\x).ar*n.ar(0.1,3),n.ar(3,6)).tanh;9.do{a=AllpassL.ar(a,0.3,{0.2.rand+0.1}!2,5)};a.tanh}).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, 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": "Show me a self-contained SuperCollider patch using `AnalogIn`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `AnalogOut` and actually plays. Assume nothing about the session."}, {"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": "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 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 a SuperCollider patch that uses `Ball` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a SuperCollider patch that uses `BinaryOpUGen` and actually plays. Assume nothing about the session."}, {"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": "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{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"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": "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 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": "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 `Buffer`: bind everything it needs first."}, {"role": "assistant", "content": "```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 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": "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 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 `ControlName`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `ControlSpec`. Define every value it uses."}, {"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 self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```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": "Write a self-contained SuperCollider patch that uses `Dbrown`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Ddup`: bind everything it needs first."}, {"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 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 self-contained SuperCollider patch that uses `Dgeom`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dibrown` and actually plays. Assume nothing about the session."}, {"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": "Write a complete SuperCollider patch built around `DigitalIO` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `DigitalIn`. Define every value it uses."}, {"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 SuperCollider patch that uses `DigitalOut` and actually plays. Assume nothing about the session."}, {"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 self-contained SuperCollider patch that uses `Diwhite`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Drand`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dreset`: bind everything it needs first."}, {"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": "Write a self-contained SuperCollider patch that uses `Dseq`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `Dser`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dseries` and actually plays. Assume nothing about the session."}, {"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": "Show me a self-contained SuperCollider patch using `Dshuf`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dstutter`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch1`: bind everything it needs first."}, {"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 SuperCollider patch that uses `Dust` and actually plays. Assume nothing about the session."}, {"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 complete SuperCollider patch built around `Dust2` that runs as it is."}, {"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": "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 `Dwhite`. Define every value it uses."}, {"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 complete SuperCollider patch built around `Dwrand` that runs as it is."}, {"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": "Show me a self-contained SuperCollider patch using `Dxrand`: bind everything it needs first."}, {"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": "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 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 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 SuperCollider patch that uses `FFTTrigger` and actually plays. Assume nothing about the session."}, {"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": "Write a SuperCollider patch that uses `FOS` and actually plays. Assume nothing about the session."}, {"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": "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 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": "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": "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": "Write a SuperCollider patch that uses `GrayNoise` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a complete SuperCollider patch built around `IFFT` that runs as it is."}, {"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 `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 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": "Write a self-contained SuperCollider patch that uses `MouseX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.control(s, 9); // nine channel control rate\nb.setn([244, 737, 20, 271, 382, 172, 4, 2399, 251]);\n{\n var index = MouseX.kr(0, 30);\n Blip.ar(InBus.ar(b, 2, index, \\wrap)) * 0.1\n}.play;\n)\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 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": "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 me a self-contained SuperCollider patch using `KeyTrack`: bind everything it needs first."}, {"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": "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": "Write a complete SuperCollider patch built around `LastValue` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"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 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 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 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 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": "Write a complete SuperCollider patch built around `MultiTap` that runs as it is."}, {"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 complete SuperCollider patch built around `MultiplexAnalogIn` that runs as it is."}, {"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": "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": "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": "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": "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": "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.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `NodeControl`. Define every value it uses."}, {"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": "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": "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": "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": "Show me a self-contained SuperCollider patch using `PV_BrickWall`: bind everything it needs first."}, {"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 self-contained SuperCollider patch that uses `PV_Mul`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `PV_PhaseShift`: bind everything it needs first."}, {"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": "Write a complete SuperCollider patch built around `PV_PhaseShift90` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ |out = 0, bufnum = 0|\n var in, fft, fft2, shifted;\n in = SinOsc.ar(500, 0, 0.1);\n fft = FFT(LocalBuf(2048), in);\n fft2 = FFT(LocalBuf(2048), in);\n shifted = PV_PhaseShift90(fft);\n Out.ar(out, [IFFT(fft2), IFFT(shifted)]);\n}.scope\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `PV_RectComb`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `PackFFT` and actually plays. Assume nothing about the session."}, {"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": "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 `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": "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 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 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 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 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 `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 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 `PulseCount`: bind everything it needs first."}, {"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 `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 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": "Write a complete SuperCollider patch built around `QuadC` that runs as it is."}, {"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 complete SuperCollider patch built around `QuadL` that runs as it is."}, {"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 SuperCollider patch that uses `QuadN` and actually plays. Assume nothing about the session."}, {"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": "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": "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": "Show me a self-contained SuperCollider patch using `Recorder`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `RunningSum` and actually plays. Assume nothing about the session."}, {"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": "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 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 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": "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 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 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 self-contained SuperCollider patch that uses `SpecCentroid`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, 2048, 1);\n(\nx = {\n var in, chain, freq, rq, centroid;\n\n // freq = LFPar.kr(0.3).exprange(100, 1000);\n freq = MouseY.kr(1000, 100, 1);\n in = Blip.ar(freq, MouseX.kr(1, 100, 1));\n chain = FFT(LocalBuf(2048), in);\n centroid = SpecCentroid.kr(chain);\n centroid.poll(10);\n in.dup * 0.1\n\n}.play\n);\n\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SpecFlatness` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ // Example - vary mixture of white noise and pure tone with the mouse\n var in, chain, flat, flatdb, flatdbsquish;\n\n in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1, 1));\n chain = FFT(LocalBuf(2048), in);\n Out.ar(0, in * 0.1);\n\n flat = SpecFlatness.kr(chain);\n\n flatdb = 10 * flat.log; // Convert to decibels\n flatdbsquish = LinLin.kr(flatdb, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.\n\n flat.poll(10, \"flatness: \");\n flatdb.poll(10, \"flatness (db): \");\n\n [flat, flatdbsquish]\n}.scope;\n);\n\n(\n{ // Now try with your own voice\n var in, chain;\n in = SoundIn.ar([0, 1]).mean;\n chain = FFT(LocalBuf(2048), in);\n Out.kr(0, [in, SpecFlatness.kr(chain).poll(1, \"flatness: \")]);\n}.scope;\n)\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": "Write a complete SuperCollider patch built around `TChoose` that runs as it is."}, {"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 complete SuperCollider patch built around `TIRand` that runs as it is."}, {"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": "Write a SuperCollider patch that uses `TWChoose` and actually plays. Assume nothing about the session."}, {"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": "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": "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 `Unpack1FFT`: bind everything it needs first."}, {"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 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": "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 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 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": "Write a SuperCollider patch that uses `WhiteNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), in); // encode to frequency domain\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4)); // process\n IFFT(chain) // decode to time domain\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Ringz` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = Ringz.ar(Impulse.ar([2, 3]), [700, 800], 0.1) * 5; // stereo input\n chain = FFT({ LocalBuf(2048) } ! 2, in); // array of two local buffers\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4));\n IFFT(chain) // returns a stereo out\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFClipNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { var inA, chainA, chainB;\n inA = LFClipNoise.ar(100);\n chainA = FFT(LocalBuf(2048, 1), inA);\n chainB = PV_PhaseShift(chainA, pi);\n // half-circle phase shift should result in an inverse signal\n // in practice, ultra-low frequencies sneak through\n // but you won't hear very much here\n IFFT(chainA) + IFFT(chainB);\n}.play;\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": "Write a self-contained SuperCollider patch that uses `Ringz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nx = { arg freq=1000; Ringz.ar(Crackle.ar(1.95, 0.1), freq, 0.05) }.play(s);\nx.set(\\freq, 1500);\nx.free;\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 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 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": "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": "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 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 complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// define a control\nSynthDef(\"line\", { arg i_bus=10, i_start=1000, i_end=500, i_time=1;\n ReplaceOut.kr(i_bus, Line.kr(i_start, i_end, i_time, doneAction: Done.freeSelf));\n}).add\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": "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 `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 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": "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": "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 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 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": "Give me a complete SuperCollider patch for (thor magnusson) (2006) An instrumentalist inside a synthdef: bind everything it needs before it is used."}, {"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": "Write a SuperCollider patch for shepard tones alberto de campo that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// shepard tones\n// alberto de campo\n(\nvar ampTable, freqTable, b1, b2;\n\nampTable = Signal.hanningWindow(1024).squared;\nfreqTable = Signal.newClear(1024).waveFill({ arg i; 0.5 ** i * 20000 }, 0, 10);\n\nb1 = Buffer.loadCollection(s, freqTable);\nb2 = Buffer.loadCollection(s, ampTable);\n\n{\n var freqs, amps, phasor, ratescale, rate, phases;\n ratescale = 1024 / 44100 / 10;\n rate = 0.1; // once per 10 sec\n phasor = Phasor.ar(0, rate * ratescale, 0, 1024);\n phases = (0..9) * 0.1 * 1024 + phasor;\n\n freqs = BufRd.ar(1, b1.bufnum, phases);\n amps = BufRd.ar(1, b2.bufnum, phases);\n\n Mix.ar(SinOsc.ar(freqs) * amps) * 0.1;\n}.play;\n\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": "Write a complete SuperCollider patch built around `LFPulse` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n4.insp;\n[1,2,3].insp;\nPageLayout.insp;\nSynthDef(\"yawn\",{ arg freq=100;\n Out.ar(0,Saw.ar * LFPulse.kr(3))\n}).insp;\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 self-contained SuperCollider patch for reverbio (a SuperCollider snippet). Define every value it uses."}, {"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": "Give me a complete SuperCollider patch for flanger (a SuperCollider snippet): bind everything it needs before it is used."}, {"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": "Write a self-contained SuperCollider patch for it goes beyond vibrato too. Define every value it uses."}, {"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 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": "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": "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 SuperCollider patch for running water (simple). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\simpleRunningWater).fadeTime = 4;\n\n\nNdef(\\simpleRunningWater, {\n var mod, freq, ampMod, src;\n \n mod = {LFNoise0.ar(170)}!2;\n \n freq = mod.linexp(-1, 1, \\lowFreq.kr(400, 8), 2400).lag(0.01); // * Line.kr(1, 0.01, 40);\n ampMod = 0.5 + mod.linlin(-1, 1, 0.5, 0).lag(0.1);\n \n ampMod = ampMod * AmpComp.ar(freq);\n \n src = LPF.ar(SinOsc.ar(\n freq,\n 0.6, \n ampMod\n ), 4000);\n \n // src * LFPulse.ar(10);\n src\n \n})\n);\n\nNdef(\\simpleRunningWater).set(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).xset(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).gui\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 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 for number 10 for Quiz 4a. Start by defining the values the patch depends on."}, {"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": "Write a SuperCollider patch for Breathing Ocean (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var lew, bpf;\n lew = WhiteNoise.ar(\n mul: 0.5,\n add: 0.1); \n bpf = LPF.ar(in: lew, freq: SinOsc.kr(1/8).range(100, 800));\n Out.ar(0, bpf);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for outer beat. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```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```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Nuclear Fallout (a SuperCollider snippet). Define every value it uses."}, {"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 for Electrode Theremin (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 SuperCollider patch for We all could use a little more that runs as it is, with nothing assumed about the session."}, {"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": "Write a SuperCollider patch for 8-bit synth (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 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 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 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": "Write a self-contained SuperCollider patch for radio static with tuning noise (a SuperCollider snippet). Define every value it uses."}, {"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 for Digital Bird sounds that runs as it is, with nothing assumed about the session."}, {"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": "Give me a complete SuperCollider patch for Spring saw: bind everything it needs before it is used."}, {"role": "assistant", "content": "```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```"}]} {"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 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": "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": "Write a self-contained SuperCollider patch for Swarm of sound files. Define every value it uses."}, {"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 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 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 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 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": "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": "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": "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": "Give me a complete SuperCollider patch for poor man's panning: bind everything it needs before it is used."}, {"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": "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 self-contained SuperCollider patch for now with snooze (press mouse button). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6, now = 10|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1) * SetResetFF.kr(Dust.kr(1/now), MouseButton.kr)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Feedback resonator. Start by defining the values the patch depends on."}, {"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": "Give me a complete SuperCollider patch for Will nobody switch the damn thing off?: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Nested ifs in a SynthDef: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Wake up call: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for phasemodulation feedback and allpass network. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nn=LFNoise1;Ndef(\\x,{a=SinOsc.ar(65,Ndef(\\x).ar*n.ar(0.1,3),n.ar(3,6)).tanh;9.do{a=AllpassL.ar(a,0.3,{0.2.rand+0.1}!2,5)};a.tanh}).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, 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": "Show me a self-contained SuperCollider patch using `AnalogIn`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `AnalogOut` and actually plays. Assume nothing about the session."}, {"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": "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 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 a SuperCollider patch that uses `Ball` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a SuperCollider patch that uses `BinaryOpUGen` and actually plays. Assume nothing about the session."}, {"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": "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{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"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": "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 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": "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 `Buffer`: bind everything it needs first."}, {"role": "assistant", "content": "```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 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": "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 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 `ControlName`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `ControlSpec`. Define every value it uses."}, {"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 self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```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": "Write a self-contained SuperCollider patch that uses `Dbrown`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Ddup`: bind everything it needs first."}, {"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 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 self-contained SuperCollider patch that uses `Dgeom`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dibrown` and actually plays. Assume nothing about the session."}, {"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": "Write a complete SuperCollider patch built around `DigitalIO` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `DigitalIn`. Define every value it uses."}, {"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 SuperCollider patch that uses `DigitalOut` and actually plays. Assume nothing about the session."}, {"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 self-contained SuperCollider patch that uses `Diwhite`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Drand`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dreset`: bind everything it needs first."}, {"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": "Write a self-contained SuperCollider patch that uses `Dseq`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `Dser`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dseries` and actually plays. Assume nothing about the session."}, {"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": "Show me a self-contained SuperCollider patch using `Dshuf`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dstutter`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch1`: bind everything it needs first."}, {"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 SuperCollider patch that uses `Dust` and actually plays. Assume nothing about the session."}, {"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 complete SuperCollider patch built around `Dust2` that runs as it is."}, {"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": "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 `Dwhite`. Define every value it uses."}, {"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 complete SuperCollider patch built around `Dwrand` that runs as it is."}, {"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": "Show me a self-contained SuperCollider patch using `Dxrand`: bind everything it needs first."}, {"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": "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 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 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 SuperCollider patch that uses `FFTTrigger` and actually plays. Assume nothing about the session."}, {"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": "Write a SuperCollider patch that uses `FOS` and actually plays. Assume nothing about the session."}, {"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": "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 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": "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": "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": "Write a SuperCollider patch that uses `GrayNoise` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a complete SuperCollider patch built around `IFFT` that runs as it is."}, {"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 `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 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": "Write a self-contained SuperCollider patch that uses `MouseX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.control(s, 9); // nine channel control rate\nb.setn([244, 737, 20, 271, 382, 172, 4, 2399, 251]);\n{\n var index = MouseX.kr(0, 30);\n Blip.ar(InBus.ar(b, 2, index, \\wrap)) * 0.1\n}.play;\n)\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 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": "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 me a self-contained SuperCollider patch using `KeyTrack`: bind everything it needs first."}, {"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": "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": "Write a complete SuperCollider patch built around `LastValue` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"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 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 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 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 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": "Write a complete SuperCollider patch built around `MultiTap` that runs as it is."}, {"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 complete SuperCollider patch built around `MultiplexAnalogIn` that runs as it is."}, {"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": "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": "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": "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": "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": "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.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `NodeControl`. Define every value it uses."}, {"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": "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": "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": "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": "Show me a self-contained SuperCollider patch using `PV_BrickWall`: bind everything it needs first."}, {"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 self-contained SuperCollider patch that uses `PV_Mul`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `PV_PhaseShift`: bind everything it needs first."}, {"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": "Write a complete SuperCollider patch built around `PV_PhaseShift90` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ |out = 0, bufnum = 0|\n var in, fft, fft2, shifted;\n in = SinOsc.ar(500, 0, 0.1);\n fft = FFT(LocalBuf(2048), in);\n fft2 = FFT(LocalBuf(2048), in);\n shifted = PV_PhaseShift90(fft);\n Out.ar(out, [IFFT(fft2), IFFT(shifted)]);\n}.scope\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `PV_RectComb`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `PackFFT` and actually plays. Assume nothing about the session."}, {"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": "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 `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": "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 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 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 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 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 `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 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 `PulseCount`: bind everything it needs first."}, {"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 `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 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": "Write a complete SuperCollider patch built around `QuadC` that runs as it is."}, {"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 complete SuperCollider patch built around `QuadL` that runs as it is."}, {"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 SuperCollider patch that uses `QuadN` and actually plays. Assume nothing about the session."}, {"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": "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": "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": "Show me a self-contained SuperCollider patch using `Recorder`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `RunningSum` and actually plays. Assume nothing about the session."}, {"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": "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 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 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": "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 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 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 self-contained SuperCollider patch that uses `SpecCentroid`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, 2048, 1);\n(\nx = {\n var in, chain, freq, rq, centroid;\n\n // freq = LFPar.kr(0.3).exprange(100, 1000);\n freq = MouseY.kr(1000, 100, 1);\n in = Blip.ar(freq, MouseX.kr(1, 100, 1));\n chain = FFT(LocalBuf(2048), in);\n centroid = SpecCentroid.kr(chain);\n centroid.poll(10);\n in.dup * 0.1\n\n}.play\n);\n\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SpecFlatness` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ // Example - vary mixture of white noise and pure tone with the mouse\n var in, chain, flat, flatdb, flatdbsquish;\n\n in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1, 1));\n chain = FFT(LocalBuf(2048), in);\n Out.ar(0, in * 0.1);\n\n flat = SpecFlatness.kr(chain);\n\n flatdb = 10 * flat.log; // Convert to decibels\n flatdbsquish = LinLin.kr(flatdb, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.\n\n flat.poll(10, \"flatness: \");\n flatdb.poll(10, \"flatness (db): \");\n\n [flat, flatdbsquish]\n}.scope;\n);\n\n(\n{ // Now try with your own voice\n var in, chain;\n in = SoundIn.ar([0, 1]).mean;\n chain = FFT(LocalBuf(2048), in);\n Out.kr(0, [in, SpecFlatness.kr(chain).poll(1, \"flatness: \")]);\n}.scope;\n)\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": "Write a complete SuperCollider patch built around `TChoose` that runs as it is."}, {"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 complete SuperCollider patch built around `TIRand` that runs as it is."}, {"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": "Write a SuperCollider patch that uses `TWChoose` and actually plays. Assume nothing about the session."}, {"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": "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": "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 `Unpack1FFT`: bind everything it needs first."}, {"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 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": "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 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 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": "Write a SuperCollider patch that uses `WhiteNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), in); // encode to frequency domain\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4)); // process\n IFFT(chain) // decode to time domain\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Ringz` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = Ringz.ar(Impulse.ar([2, 3]), [700, 800], 0.1) * 5; // stereo input\n chain = FFT({ LocalBuf(2048) } ! 2, in); // array of two local buffers\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4));\n IFFT(chain) // returns a stereo out\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFClipNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { var inA, chainA, chainB;\n inA = LFClipNoise.ar(100);\n chainA = FFT(LocalBuf(2048, 1), inA);\n chainB = PV_PhaseShift(chainA, pi);\n // half-circle phase shift should result in an inverse signal\n // in practice, ultra-low frequencies sneak through\n // but you won't hear very much here\n IFFT(chainA) + IFFT(chainB);\n}.play;\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": "Write a self-contained SuperCollider patch that uses `Ringz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nx = { arg freq=1000; Ringz.ar(Crackle.ar(1.95, 0.1), freq, 0.05) }.play(s);\nx.set(\\freq, 1500);\nx.free;\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 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 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": "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": "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 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 complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// define a control\nSynthDef(\"line\", { arg i_bus=10, i_start=1000, i_end=500, i_time=1;\n ReplaceOut.kr(i_bus, Line.kr(i_start, i_end, i_time, doneAction: Done.freeSelf));\n}).add\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": "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 `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 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": "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": "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 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 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": "Give me a complete SuperCollider patch for (thor magnusson) (2006) An instrumentalist inside a synthdef: bind everything it needs before it is used."}, {"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": "Write a SuperCollider patch for shepard tones alberto de campo that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// shepard tones\n// alberto de campo\n(\nvar ampTable, freqTable, b1, b2;\n\nampTable = Signal.hanningWindow(1024).squared;\nfreqTable = Signal.newClear(1024).waveFill({ arg i; 0.5 ** i * 20000 }, 0, 10);\n\nb1 = Buffer.loadCollection(s, freqTable);\nb2 = Buffer.loadCollection(s, ampTable);\n\n{\n var freqs, amps, phasor, ratescale, rate, phases;\n ratescale = 1024 / 44100 / 10;\n rate = 0.1; // once per 10 sec\n phasor = Phasor.ar(0, rate * ratescale, 0, 1024);\n phases = (0..9) * 0.1 * 1024 + phasor;\n\n freqs = BufRd.ar(1, b1.bufnum, phases);\n amps = BufRd.ar(1, b2.bufnum, phases);\n\n Mix.ar(SinOsc.ar(freqs) * amps) * 0.1;\n}.play;\n\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": "Write a complete SuperCollider patch built around `LFPulse` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n4.insp;\n[1,2,3].insp;\nPageLayout.insp;\nSynthDef(\"yawn\",{ arg freq=100;\n Out.ar(0,Saw.ar * LFPulse.kr(3))\n}).insp;\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 self-contained SuperCollider patch for reverbio (a SuperCollider snippet). Define every value it uses."}, {"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": "Give me a complete SuperCollider patch for flanger (a SuperCollider snippet): bind everything it needs before it is used."}, {"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": "Write a self-contained SuperCollider patch for it goes beyond vibrato too. Define every value it uses."}, {"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 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": "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": "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 SuperCollider patch for running water (simple). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\nNdef(\\simpleRunningWater).fadeTime = 4;\n\n\nNdef(\\simpleRunningWater, {\n var mod, freq, ampMod, src;\n \n mod = {LFNoise0.ar(170)}!2;\n \n freq = mod.linexp(-1, 1, \\lowFreq.kr(400, 8), 2400).lag(0.01); // * Line.kr(1, 0.01, 40);\n ampMod = 0.5 + mod.linlin(-1, 1, 0.5, 0).lag(0.1);\n \n ampMod = ampMod * AmpComp.ar(freq);\n \n src = LPF.ar(SinOsc.ar(\n freq,\n 0.6, \n ampMod\n ), 4000);\n \n // src * LFPulse.ar(10);\n src\n \n})\n);\n\nNdef(\\simpleRunningWater).set(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).xset(\\lowFreq, 1000);\nNdef(\\simpleRunningWater).gui\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 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 for number 10 for Quiz 4a. Start by defining the values the patch depends on."}, {"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": "Write a SuperCollider patch for Breathing Ocean (a SuperCollider snippet). Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var lew, bpf;\n lew = WhiteNoise.ar(\n mul: 0.5,\n add: 0.1); \n bpf = LPF.ar(in: lew, freq: SinOsc.kr(1/8).range(100, 800));\n Out.ar(0, bpf);\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for outer beat. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```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```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch for Nuclear Fallout (a SuperCollider snippet). Define every value it uses."}, {"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 for Electrode Theremin (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 SuperCollider patch for We all could use a little more that runs as it is, with nothing assumed about the session."}, {"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": "Write a SuperCollider patch for 8-bit synth (a SuperCollider snippet) that runs as it is, with nothing assumed about the session."}, {"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 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 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 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": "Write a self-contained SuperCollider patch for radio static with tuning noise (a SuperCollider snippet). Define every value it uses."}, {"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 for Digital Bird sounds that runs as it is, with nothing assumed about the session."}, {"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": "Give me a complete SuperCollider patch for Spring saw: bind everything it needs before it is used."}, {"role": "assistant", "content": "```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```"}]} {"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 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": "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": "Write a self-contained SuperCollider patch for Swarm of sound files. Define every value it uses."}, {"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 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 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 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 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": "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": "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": "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": "Give me a complete SuperCollider patch for poor man's panning: bind everything it needs before it is used."}, {"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": "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 self-contained SuperCollider patch for now with snooze (press mouse button). Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6, now = 10|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1) * SetResetFF.kr(Dust.kr(1/now), MouseButton.kr)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for Feedback resonator. Start by defining the values the patch depends on."}, {"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": "Give me a complete SuperCollider patch for Will nobody switch the damn thing off?: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Nested ifs in a SynthDef: bind everything it needs before it is used."}, {"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": "Give me a complete SuperCollider patch for Wake up call: bind everything it needs before it is used."}, {"role": "assistant", "content": "```supercollider\nNdef(\\a, { |freq=2000, rate=1, width=0.6|\n LFPulse.kr(rate, 0, 4/6) *\n LFPulse.kr(rate * 6, 0, width) *\n Pulse.ar(freq, 0.3, 0.1)\n}).play\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch for phasemodulation feedback and allpass network. Start by defining the values the patch depends on."}, {"role": "assistant", "content": "```supercollider\nn=LFNoise1;Ndef(\\x,{a=SinOsc.ar(65,Ndef(\\x).ar*n.ar(0.1,3),n.ar(3,6)).tanh;9.do{a=AllpassL.ar(a,0.3,{0.2.rand+0.1}!2,5)};a.tanh}).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, 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": "Show me a self-contained SuperCollider patch using `AnalogIn`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `AnalogOut` and actually plays. Assume nothing about the session."}, {"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": "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 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 a SuperCollider patch that uses `Ball` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a SuperCollider patch that uses `BinaryOpUGen` and actually plays. Assume nothing about the session."}, {"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": "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{ BufRd.ar(1, b, Sweep.ar(Impulse.ar(BufDur.kr(b).reciprocal), BufSampleRate.kr(b))) }.play;\n\nb.free\n```"}]} {"conversations": [{"role": "user", "content": "Show me a self-contained SuperCollider patch using `BufRd`: bind everything it needs first."}, {"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": "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 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": "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 `Buffer`: bind everything it needs first."}, {"role": "assistant", "content": "```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 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": "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 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 `ControlName`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `ControlSpec`. Define every value it uses."}, {"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 self-contained SuperCollider patch using `Convolution2L`: bind everything it needs first."}, {"role": "assistant", "content": "```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": "Write a self-contained SuperCollider patch that uses `Dbrown`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Ddup`: bind everything it needs first."}, {"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 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 self-contained SuperCollider patch that uses `Dgeom`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dibrown` and actually plays. Assume nothing about the session."}, {"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": "Write a complete SuperCollider patch built around `DigitalIO` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `DigitalIn`. Define every value it uses."}, {"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 SuperCollider patch that uses `DigitalOut` and actually plays. Assume nothing about the session."}, {"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 self-contained SuperCollider patch that uses `Diwhite`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `Drand`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dreset`: bind everything it needs first."}, {"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": "Write a self-contained SuperCollider patch that uses `Dseq`. Define every value it uses."}, {"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 self-contained SuperCollider patch that uses `Dser`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `Dseries` and actually plays. Assume nothing about the session."}, {"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": "Show me a self-contained SuperCollider patch using `Dshuf`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dstutter`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch`: bind everything it needs first."}, {"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": "Show me a self-contained SuperCollider patch using `Dswitch1`: bind everything it needs first."}, {"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 SuperCollider patch that uses `Dust` and actually plays. Assume nothing about the session."}, {"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 complete SuperCollider patch built around `Dust2` that runs as it is."}, {"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": "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 `Dwhite`. Define every value it uses."}, {"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 complete SuperCollider patch built around `Dwrand` that runs as it is."}, {"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": "Show me a self-contained SuperCollider patch using `Dxrand`: bind everything it needs first."}, {"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": "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 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 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 SuperCollider patch that uses `FFTTrigger` and actually plays. Assume nothing about the session."}, {"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": "Write a SuperCollider patch that uses `FOS` and actually plays. Assume nothing about the session."}, {"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": "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 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": "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": "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": "Write a SuperCollider patch that uses `GrayNoise` and actually plays. Assume nothing about the session."}, {"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": "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": "Write a complete SuperCollider patch built around `IFFT` that runs as it is."}, {"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 `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 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": "Write a self-contained SuperCollider patch that uses `MouseX`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\n(\nb = Bus.control(s, 9); // nine channel control rate\nb.setn([244, 737, 20, 271, 382, 172, 4, 2399, 251]);\n{\n var index = MouseX.kr(0, 30);\n Blip.ar(InBus.ar(b, 2, index, \\wrap)) * 0.1\n}.play;\n)\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 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": "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 me a self-contained SuperCollider patch using `KeyTrack`: bind everything it needs first."}, {"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": "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": "Write a complete SuperCollider patch built around `LastValue` that runs as it is."}, {"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 self-contained SuperCollider patch that uses `LeastChange`. Define every value it uses."}, {"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 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 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 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 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": "Write a complete SuperCollider patch built around `MultiTap` that runs as it is."}, {"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 complete SuperCollider patch built around `MultiplexAnalogIn` that runs as it is."}, {"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": "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": "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": "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": "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": "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.run(false);\nx.run; // default is true\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `NodeControl`. Define every value it uses."}, {"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": "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": "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": "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": "Show me a self-contained SuperCollider patch using `PV_BrickWall`: bind everything it needs first."}, {"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 self-contained SuperCollider patch that uses `PV_Mul`. Define every value it uses."}, {"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": "Show me a self-contained SuperCollider patch using `PV_PhaseShift`: bind everything it needs first."}, {"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": "Write a complete SuperCollider patch built around `PV_PhaseShift90` that runs as it is."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ |out = 0, bufnum = 0|\n var in, fft, fft2, shifted;\n in = SinOsc.ar(500, 0, 0.1);\n fft = FFT(LocalBuf(2048), in);\n fft2 = FFT(LocalBuf(2048), in);\n shifted = PV_PhaseShift90(fft);\n Out.ar(out, [IFFT(fft2), IFFT(shifted)]);\n}.scope\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a self-contained SuperCollider patch that uses `PV_RectComb`. Define every value it uses."}, {"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": "Write a SuperCollider patch that uses `PackFFT` and actually plays. Assume nothing about the session."}, {"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": "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 `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": "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 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 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 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 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 `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 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 `PulseCount`: bind everything it needs first."}, {"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 `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 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": "Write a complete SuperCollider patch built around `QuadC` that runs as it is."}, {"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 complete SuperCollider patch built around `QuadL` that runs as it is."}, {"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 SuperCollider patch that uses `QuadN` and actually plays. Assume nothing about the session."}, {"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": "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": "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": "Show me a self-contained SuperCollider patch using `Recorder`: bind everything it needs first."}, {"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": "Write a SuperCollider patch that uses `RunningSum` and actually plays. Assume nothing about the session."}, {"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": "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 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 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": "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 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 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 self-contained SuperCollider patch that uses `SpecCentroid`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\ns.boot;\nb = Buffer.alloc(s, 2048, 1);\n(\nx = {\n var in, chain, freq, rq, centroid;\n\n // freq = LFPar.kr(0.3).exprange(100, 1000);\n freq = MouseY.kr(1000, 100, 1);\n in = Blip.ar(freq, MouseX.kr(1, 100, 1));\n chain = FFT(LocalBuf(2048), in);\n centroid = SpecCentroid.kr(chain);\n centroid.poll(10);\n in.dup * 0.1\n\n}.play\n);\n\nx.free;\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `SpecFlatness` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\ns.boot;\n\n(\n{ // Example - vary mixture of white noise and pure tone with the mouse\n var in, chain, flat, flatdb, flatdbsquish;\n\n in = XFade2.ar(WhiteNoise.ar, SinOsc.ar, MouseX.kr(-1, 1));\n chain = FFT(LocalBuf(2048), in);\n Out.ar(0, in * 0.1);\n\n flat = SpecFlatness.kr(chain);\n\n flatdb = 10 * flat.log; // Convert to decibels\n flatdbsquish = LinLin.kr(flatdb, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.\n\n flat.poll(10, \"flatness: \");\n flatdb.poll(10, \"flatness (db): \");\n\n [flat, flatdbsquish]\n}.scope;\n);\n\n(\n{ // Now try with your own voice\n var in, chain;\n in = SoundIn.ar([0, 1]).mean;\n chain = FFT(LocalBuf(2048), in);\n Out.kr(0, [in, SpecFlatness.kr(chain).poll(1, \"flatness: \")]);\n}.scope;\n)\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": "Write a complete SuperCollider patch built around `TChoose` that runs as it is."}, {"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 complete SuperCollider patch built around `TIRand` that runs as it is."}, {"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": "Write a SuperCollider patch that uses `TWChoose` and actually plays. Assume nothing about the session."}, {"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": "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": "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 `Unpack1FFT`: bind everything it needs first."}, {"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 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": "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 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 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": "Write a SuperCollider patch that uses `WhiteNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = WhiteNoise.ar(0.8);\n chain = FFT(LocalBuf(2048), in); // encode to frequency domain\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4)); // process\n IFFT(chain) // decode to time domain\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `Ringz` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\n{\n var in, chain;\n in = Ringz.ar(Impulse.ar([2, 3]), [700, 800], 0.1) * 5; // stereo input\n chain = FFT({ LocalBuf(2048) } ! 2, in); // array of two local buffers\n chain = PV_RandComb(chain, 0.95, Impulse.kr(0.4));\n IFFT(chain) // returns a stereo out\n}.play;\n)\n```"}]} {"conversations": [{"role": "user", "content": "Write a SuperCollider patch that uses `LFClipNoise` and actually plays. Assume nothing about the session."}, {"role": "assistant", "content": "```supercollider\n(\nx = { var inA, chainA, chainB;\n inA = LFClipNoise.ar(100);\n chainA = FFT(LocalBuf(2048, 1), inA);\n chainB = PV_PhaseShift(chainA, pi);\n // half-circle phase shift should result in an inverse signal\n // in practice, ultra-low frequencies sneak through\n // but you won't hear very much here\n IFFT(chainA) + IFFT(chainB);\n}.play;\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": "Write a self-contained SuperCollider patch that uses `Ringz`. Define every value it uses."}, {"role": "assistant", "content": "```supercollider\nx = { arg freq=1000; Ringz.ar(Crackle.ar(1.95, 0.1), freq, 0.05) }.play(s);\nx.set(\\freq, 1500);\nx.free;\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 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 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": "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": "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 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 complete SuperCollider patch built around `ReplaceOut` that runs as it is."}, {"role": "assistant", "content": "```supercollider\n(\n// define a control\nSynthDef(\"line\", { arg i_bus=10, i_start=1000, i_end=500, i_time=1;\n ReplaceOut.kr(i_bus, Line.kr(i_start, i_end, i_time, doneAction: Done.freeSelf));\n}).add\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": "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 `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 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": "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": "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 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 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": "Give me a complete SuperCollider patch for (thor magnusson) (2006) An instrumentalist inside a synthdef: bind everything it needs before it is used."}, {"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": "Write a SuperCollider patch for shepard tones alberto de campo that runs as it is, with nothing assumed about the session."}, {"role": "assistant", "content": "```supercollider\n// shepard tones\n// alberto de campo\n(\nvar ampTable, freqTable, b1, b2;\n\nampTable = Signal.hanningWindow(1024).squared;\nfreqTable = Signal.newClear(1024).waveFill({ arg i; 0.5 ** i * 20000 }, 0, 10);\n\nb1 = Buffer.loadCollection(s, freqTable);\nb2 = Buffer.loadCollection(s, ampTable);\n\n{\n var freqs, amps, phasor, ratescale, rate, phases;\n ratescale = 1024 / 44100 / 10;\n rate = 0.1; // once per 10 sec\n phasor = Phasor.ar(0, rate * ratescale, 0, 1024);\n phases = (0..9) * 0.1 * 1024 + phasor;\n\n freqs = BufRd.ar(1, b1.bufnum, phases);\n amps = BufRd.ar(1, b2.bufnum, phases);\n\n Mix.ar(SinOsc.ar(freqs) * amps) * 0.1;\n}.play;\n\n)\n```"}]}