File size: 5,875 Bytes
3a3e909
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
{"conversations": [{"role": "user", "content": "I typed `Impule` where a trigger should be. What is the class actually called?"}, {"role": "assistant", "content": "The class is `Impulse`, not `Impule` - the typo is the whole failure, since an unknown class cannot be resolved at parse time.\n\n```supercollider\n(\nSynthDef(\\click, { |out = 0, amp = 0.2|\n    var trig = Impulse.kr(12);\n    var env = EnvGen.kr(Env.perc(0.001, 0.05), trig);\n    Out.ar(out, (WhiteNoise.ar(0.5) * env * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 41, "answer_tokens": 168, "source_id": "cls:000"}
{"conversations": [{"role": "user", "content": "Is `Envelope` a SuperCollider class?"}, {"role": "assistant", "content": "No. The envelope class is `Env`, and the UGen that reads one is `EnvGen`. `Envelope` is the English word, not a class.\n\n```supercollider\n(\nSynthDef(\\blip, { |out = 0, freq = 440, amp = 0.2|\n    var env = EnvGen.kr(Env.perc(0.005, 0.3, 1, -4), doneAction: 2);\n    Out.ar(out, (SinOsc.ar(freq) * env * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 34, "answer_tokens": 172, "source_id": "cls:001"}
{"conversations": [{"role": "user", "content": "I wrote `Freq` as if it were a UGen. Is there one?"}, {"role": "assistant", "content": "There is no `Freq` class. Frequency is an argument you pass to an oscillator, or a control you add to the SynthDef - `SinOsc.ar(440)` already takes the frequency.\n\n```supercollider\n(\nSynthDef(\\tone, { |out = 0, freq = 440, amp = 0.15|\n    var sig = SinOsc.ar(freq);\n    Out.ar(out, (sig * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 39, "answer_tokens": 148, "source_id": "cls:002"}
{"conversations": [{"role": "user", "content": "Did I invent `SinOut`?"}, {"role": "assistant", "content": "Yes. The sine oscillator is `SinOsc`; there is no `SinOut`. `Out` is the UGen that writes to a bus, and the two are different jobs.\n\n```supercollider\n(\nSynthDef(\\sine, { |out = 0, freq = 220, amp = 0.1|\n    Out.ar(out, (SinOsc.ar(freq) * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 29, "answer_tokens": 128, "source_id": "cls:003"}
{"conversations": [{"role": "user", "content": "What is the difference between `Env` and `EnvGen`?"}, {"role": "assistant", "content": "`Env` is the shape - breakpoints and curves, a language-side value. `EnvGen` is the UGen that reads that shape at control rate and outputs a signal, which is what you multiply audio by.\n\n```supercollider\n(\nSynthDef(\\pluck, { |out = 0, freq = 330, amp = 0.25|\n    var env = EnvGen.kr(Env.perc(0.002, 0.6, 1, -6), doneAction: 2);\n    var sig = Saw.ar(freq) * env;\n    Out.ar(out, (sig * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 36, "answer_tokens": 196, "source_id": "cls:004"}
{"conversations": [{"role": "user", "content": "Is `impulse` lowercase a class?"}, {"role": "assistant", "content": "No - class names are capitalised in SuperCollider, so the trigger UGen is `Impulse`, and `Impulse.kr(8)` is a control-rate stream of single-sample clicks.\n\n```supercollider\n(\nSynthDef(\\tick, { |out = 0, rate = 8, amp = 0.2|\n    var trig = Impulse.kr(rate);\n    var env = EnvGen.kr(Env.perc(0.001, 0.08), trig);\n    Out.ar(out, (WhiteNoise.ar(0.4) * env * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 29, "answer_tokens": 191, "source_id": "cls:005"}
{"conversations": [{"role": "user", "content": "Which class makes white noise - `WhiteNoise` or `Noise`?"}, {"role": "assistant", "content": "`WhiteNoise` is the class; `Noise` is not one. Pink noise is `PinkNoise`, brown is `BrownNoise`, and all three take an amplitude argument and are audio rate only.\n\n```supercollider\n(\nSynthDef(\\hat, { |out = 0, amp = 0.2|\n    var sig = RHPF.ar(WhiteNoise.ar(1), 7000, 0.7);\n    var env = EnvGen.kr(Env.perc(0.001, 0.06), doneAction: 2);\n    Out.ar(out, (sig * env * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 39, "answer_tokens": 192, "source_id": "cls:006"}
{"conversations": [{"role": "user", "content": "Is the filter called `RLPF` or `LowPass`?"}, {"role": "assistant", "content": "`RLPF` is the resonant low-pass; there is no `LowPass` class. `LPF` is the non-resonant one, and `BLowPass` is the biquad version - the letters carry the topology.\n\n```supercollider\n(\nSynthDef(\\sweep, { |out = 0, freq = 110, amp = 0.2|\n    var lfo = SinOsc.kr(0.2).range(200, 4000);\n    var sig = RLPF.ar(Saw.ar(freq), lfo, 0.4);\n    Out.ar(out, (sig * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 35, "answer_tokens": 189, "source_id": "cls:007"}
{"conversations": [{"role": "user", "content": "What is the class for a buffer reader - `BufferPlay`, `PlayBuf` or `BufPlay`?"}, {"role": "assistant", "content": "`PlayBuf`. The buffer is an argument, not part of the class name; `BufRd` is the other reader, for random access inside a UGen graph.\n\n```supercollider\n(\nSynthDef(\\player, { |out = 0, buf = 0, rate = 1, amp = 0.4|\n    var sig = PlayBuf.ar(1, buf, rate, doneAction: 2);\n    Out.ar(out, (sig * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 56, "answer_tokens": 148, "source_id": "cls:008"}
{"conversations": [{"role": "user", "content": "Is there a `GrainBuf` argument for pan, or is panning a separate UGen?"}, {"role": "assistant", "content": "`GrainBuf` takes `pan` as its last argument, so each grain can be placed separately; you do not need a separate panner per grain.\n\n```supercollider\n(\nSynthDef(\\grainbuf_synth, { |out = 0, buf = 0, amp = 0.25|\n    var trig = Impulse.kr(12);\n    var pan = LFNoise2.kr(0.3);\n    var sig = GrainBuf.ar(2, trig, 0.1, buf, 1, Line.kr(0.05, 0.9, 8), 4, pan);\n    Out.ar(out, (sig * amp).dup);\n}).add;\n)\n```"}], "family": "CLS", "prompt_tokens": 47, "answer_tokens": 208, "source_id": "cls:009"}