Datasets:
Download data/sft/teacher_read.jsonl from vecnode/supercollider-moe-dataset: direct link, hf CLI and curl.
- Browser
- Download file 31.5 kB
-
https://huggingface.co/datasets/vecnode/supercollider-moe-dataset/resolve/main/data/sft/teacher_read.jsonl
- Command line
-
hf download hf://datasets/vecnode/supercollider-moe-dataset/data/sft/teacher_read.jsonl
-
curl -L -o teacher_read.jsonl https://huggingface.co/datasets/vecnode/supercollider-moe-dataset/resolve/main/data/sft/teacher_read.jsonl
31.5 kB
| {"schema": 1, "id": "teacher:read:001", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ SinOsc.ar([220, 330], 0, 0.1) }.play;\n```"}, {"role": "assistant", "content": "It plays a 220 Hz sine in the left channel and a 330 Hz sine in the right, as a perfect fifth.\n\n- `SinOsc.ar([220, 330])` passes an array as the frequency, so SuperCollider makes one oscillator per element - this is multi-channel expansion, not a special stereo UGen.\n- The two channels stay in one Synth, so they start together and can only be freed together.\n- `0.1` is the amplitude of each channel; two channels at 0.1 still peak near 0.2, not 0.1."}]} | |
| {"schema": 1, "id": "teacher:read:002", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\nSynthDef(\\kick_synth, { |out = 0, amp = 0.6|\n var pitch = EnvGen.kr(Env([120, 45], [0.06], [-6]));\n var env = EnvGen.ar(Env.perc(0.001, 0.25, 1, -4), doneAction: 2);\n Out.ar(out, (SinOsc.ar(pitch) * env * amp).dup);\n}).add;\n```"}, {"role": "assistant", "content": "A kick drum: a sine whose pitch falls from 120 Hz to 45 Hz in 60 ms, with a short click on top.\n\n- `Env([120, 45], [0.06], [-6])` is the pitch envelope; `EnvGen.kr` reads it as a control signal, so `pitch` is a number that changes every block.\n- `-6` is the curve: an exponential fall sounds like a drum, a linear one sounds like a laser.\n- `Env.perc(0.001, 0.25)` is the amplitude envelope - almost instant attack, 250 ms decay.\n- `doneAction: 2` frees the Synth when the amplitude envelope ends, so voices do not pile up.\n- `.dup` copies the mono signal to both output channels."}]} | |
| {"schema": 1, "id": "teacher:read:003", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(220) + SinOsc.ar(222); sig * 0.05 }.play;\n```"}, {"role": "assistant", "content": "Two nearly identical sines added together, which produces a slow beating pulse rather than a chord.\n\n- 220 Hz and 222 Hz are 2 Hz apart, so they drift in and out of phase twice a second.\n- They add constructively when in phase (louder) and cancel when opposed (quieter), which is the amplitude wobble you hear.\n- The `var` declaration makes `sig` a named node in the graph; the last expression is what gets output, so no `Out.ar` is needed inside `.play`."}]} | |
| {"schema": 1, "id": "teacher:read:004", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\nNdef(\\drone, { LFTri.ar(55) * 0.1 }).play;\n```"}, {"role": "assistant", "content": "It starts a continuous 55 Hz triangle wave you can change later without stopping it.\n\n- `Ndef` is a named node proxy: the name `\\drone` refers to a running synth that can be redefined.\n- `LFTri.ar(55)` is a triangle at 55 Hz - an A one octave below the bass guitar's low E.\n- `.play` adds it to the default group and starts it; there is no SynthDef to write first.\n- Because it is an Ndef, its signal can be routed, filtered and faded in place later."}]} | |
| {"schema": 1, "id": "teacher:read:005", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nNdef(\\drone)[1] = \\filter -> { |in| LPF.ar(in, 800) };\n```"}, {"role": "assistant", "content": "It inserts a low-pass filter into the already-running `\\drone`, with no restart.\n\n- `Ndef(\\drone)[1]` addresses the second slot of the proxy's node chain; slot 0 is the source.\n- `\\filter ->` marks this as a filter node rather than a replacement source, so it receives the previous slot's output as `in`.\n- `LPF.ar(in, 800)` cuts everything above 800 Hz, which is what turns a buzzy triangle into a hum.\n- The change is heard on the next block; the sound never stops, and `fadeTime` decides how fast the swap is."}]} | |
| {"schema": 1, "id": "teacher:read:006", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\instrument, \\kick_synth, \\dur, Pseq([1, 0.5, 0.5], inf)).play;\n```"}, {"role": "assistant", "content": "It triggers the `kick_synth` SynthDef on a repeating one beat, half beat, half beat pattern.\n\n- `\\instrument` names a SynthDef that must already be added, or the events play nothing.\n- `Pseq([1, 0.5, 0.5], inf)` repeats the duration pattern forever, so the three-note cycle restarts.\n- Durations are in beats on `TempoClock.default`, so at 1 beat per second the pattern takes 2 s.\n- Only the keys in the Pbind are passed to the SynthDef, so the synth's own defaults fill the rest."}]} | |
| {"schema": 1, "id": "teacher:read:007", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\degree, Pwhite(0, 12, inf), \\scale, Scale.minorPentatonic, \\dur, 0.2).play;\n```"}, {"role": "assistant", "content": "It plays random notes from a minor pentatonic scale, five notes a second, forever.\n\n- `Pwhite(0, 12, inf)` draws a new integer degree for every event; the range is inclusive.\n- `Scale.minorPentatonic` folds those degrees into the scale, so the random numbers cannot produce a sour interval.\n- With no `\\instrument` the `\\default` SynthDef is used, which turns `\\degree` into a frequency.\n- `0.2` beats at the default tempo is 5 events per second."}]} | |
| {"schema": 1, "id": "teacher:read:008", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ WhiteNoise.ar(0.2) * EnvGen.kr(Env.perc(0.001, 0.08), doneAction: 2) }.play;\n```"}, {"role": "assistant", "content": "A hi-hat: a burst of white noise 80 ms long with an instant attack.\n\n- `WhiteNoise.ar` is full-spectrum noise, which is why it reads as a cymbal rather than a tone.\n- `Env.perc(0.001, 0.08)` is the shape that makes it a hit instead of a hiss: 1 ms rise, 80 ms fall.\n- `*` multiplies the noise by the envelope, so the noise is only audible while the envelope is open.\n- `doneAction: 2` frees the Synth so repeated hits do not leave hundreds of silent nodes running.\n- An open-ended hat would put a `HPF.ar(...)` after the noise to thin it out."}]} | |
| {"schema": 1, "id": "teacher:read:009", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var noise = WhiteNoise.ar(0.3); RLPF.ar(noise, SinOsc.kr(0.2).range(200, 3000), 0.3) }.play;\n```"}, {"role": "assistant", "content": "Noise through a resonant low-pass whose cutoff sweeps between 200 Hz and 3 kHz - a classic wind or wave sound.\n\n- `SinOsc.kr(0.2)` is a control-rate sine that completes one cycle in 5 s.\n- `.range(200, 3000)` maps that -1..1 output onto the cutoff range linearly; for frequency an `.exprange` would sound more even.\n- `0.3` is `rq`, the reciprocal of Q: smaller is narrower and more resonant, larger is broader.\n- The filter is recomputed every block, so the motion is smooth rather than stepped."}]} | |
| {"schema": 1, "id": "teacher:read:010", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nb = Buffer.read(s, Platform.resourceDir +/+ \"sounds/a11wlk01.wav\");\n{ PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1) }.play;\n```"}, {"role": "assistant", "content": "It loads a sound file into a buffer and loops it at its original pitch.\n\n- `Buffer.read` is asynchronous: it returns immediately and fills the buffer later, so the second line may run before the data has arrived.\n- `Platform.resourceDir +/+ \"sounds/...\"` builds a path with the right separator on each OS.\n- `BufRateScale.kr(b)` corrects for a file whose sample rate differs from the server's, which keeps the pitch honest.\n- `1` is the number of channels; it must match the file or only part of it is heard.\n- `loop: 1` restarts the read position at the end instead of going silent."}]} | |
| {"schema": 1, "id": "teacher:read:011", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var trig = Impulse.kr(12);\n var pos = LFNoise1.kr(0.5).range(0.0, 0.9);\n GrainBuf.ar(2, trig, 0.06, b, 1, pos) }.play;\n```"}, {"role": "assistant", "content": "It granulates a loaded buffer: twelve 60 ms grains per second, each read from a slowly drifting position.\n\n- `Impulse.kr(12)` produces one trigger every 1/12 s, which sets the grain rate.\n- `0.06` is the grain duration in seconds; longer grains smear, shorter ones get noisy.\n- `b` is the buffer and `1` is its playback rate - 2 would play an octave up.\n- `pos` is the read position as a fraction of the buffer, and `LFNoise1.kr(0.5)` moves it so the texture does not repeat.\n- `2` is the number of output channels, so each grain is placed by the following argument if one is given."}]} | |
| {"schema": 1, "id": "teacher:read:012", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(300) * 0.1; FreeVerb.ar(sig, 0.5, 0.8) }.play;\n```"}, {"role": "assistant", "content": "A 300 Hz sine sent through a reverb, with a medium balance and a long room.\n\n- `FreeVerb.ar(in, mix, room, damp)` is the simplest reverb in the standard library.\n- `0.5` is the dry/wet mix: half the direct signal, half the reverberated one.\n- `0.8` is the room size, and it is the argument that decides how long the tail lasts.\n- The reverb is inside the same Synth, so freeing the Synth frees the tail as well."}]} | |
| {"schema": 1, "id": "teacher:read:013", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var carrier = SinOsc.ar(440);\n var mod = SinOsc.ar(7, 0, 200);\n SinOsc.ar(carrier.freq + mod) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "Vibrato: a 440 Hz tone whose pitch is wobbled 200 Hz deep at 7 Hz.\n\n- The second oscillator runs at 7 Hz, which is fast enough to hear as movement rather than as a rhythm.\n- `0, 200` sets its phase to zero and its amplitude to 200, so its output swings between -200 and +200.\n- Adding that to the carrier frequency makes the pitch sweep 240 to 640 Hz, which is a wide vibrato - 30 to 50 Hz would sound natural.\n- The outer `SinOsc.ar` is the oscillator you actually hear."}]} | |
| {"schema": 1, "id": "teacher:read:014", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nSynthDef(\\pad_synth, { |out = 0, freq = 220, amp = 0.2|\n var env = EnvGen.kr(Env.adsr(0.8, 0.4, 0.7, 2.5), gate: 1, doneAction: 2);\n var sig = LFTri.ar([freq, freq * 1.005]);\n Out.ar(out, Splay.ar(sig) * env * amp);\n}).add;\n```"}, {"role": "assistant", "content": "A pad voice: two detuned triangles with a slow attack and a long release.\n\n- `Env.adsr(0.8, 0.4, 0.7, 2.5)` is 800 ms attack, 400 ms decay to 70% sustain, 2.5 s release.\n- `gate: 1` holds the envelope open forever; the release only runs when a control named `gate` is set to 0.\n- `freq * 1.005` is about 8 cents sharp, which creates the slow chorus beat between the two channels.\n- `Splay.ar` spreads the two channels across the stereo field instead of hard-panning them."}]} | |
| {"schema": 1, "id": "teacher:read:015", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = Saw.ar(80); RLPF.ar(sig, 400, 0.08) * 0.2 }.play;\n```"}, {"role": "assistant", "content": "A sawtooth at 80 Hz through a narrow resonant low-pass - a bass with a strong formant at 400 Hz.\n\n- `Saw.ar(80)` is harmonically rich, which is what gives the filter something to remove.\n- `RLPF` is a resonant low-pass; its third argument is `rq`, the reciprocal of Q, so `0.08` is high Q and produces a pronounced peak at 400 Hz.\n- Narrow resonance on a plain saw is the cheapest way to get an acid or bass tone.\n- `* 0.2` compensates for the level boost the resonance adds."}]} | |
| {"schema": 1, "id": "teacher:read:016", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var trig = Impulse.ar(4); CombN.ar(trig, 0.3, 0.28, 6) }.play;\n```"}, {"role": "assistant", "content": "Four clicks a second fed into a comb delay tuned so almost every echo lands on the next click.\n\n- `Impulse.ar(4)` is a train of single-sample clicks at 4 Hz.\n- `CombN.ar(in, maxdelay, delaytime, decay)` delays by `0.28` s, which is slightly less than the 1/4 s between clicks, so the echoes drift.\n- `6` is the decay time in seconds: how long the echoes take to fade.\n- Short delays with feedback are how a physical-model string or a metallic ring is built."}]} | |
| {"schema": 1, "id": "teacher:read:017", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPdef(\\arp, Pbind(\\degree, Pseq([0, 4, 7, 12], inf), \\dur, 0.125));\nPdef(\\arp).play;\n```"}, {"role": "assistant", "content": "It defines a pattern under a name, then starts it separately - so the same pattern can be stopped and restarted without rewriting it.\n\n- `Pdef` stores an event pattern in a global dictionary keyed by `\\arp`.\n- Defining it does nothing audible; `.play` is what schedules it on the clock.\n- `Pdef(\\arp).stop` ends it, and replacing the definition while it plays swaps the notes at the next event.\n- `0.125` beats at the default tempo is 8 notes a second."}]} | |
| {"schema": 1, "id": "teacher:read:018", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Impulse.kr(2) * SinOsc.ar(880) }.play;\n```"}, {"role": "assistant", "content": "An 880 Hz tone chopped into two bursts a second - a tremolo, done by multiplication rather than by an envelope.\n\n- `Impulse.kr(2)` outputs a single 1 in the block where it fires and 0 the rest of the time.\n- Multiplying an audio signal by 0 silences it and by 1 passes it, so the tone is gated on and off.\n- Because the gating signal is a control-rate UGen, the on and off edges land on block boundaries, which can click.\n- `LFPulse` or an `EnvGen` with a short fade would give the same rhythm without the clicks."}]} | |
| {"schema": 1, "id": "teacher:read:019", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var sig = SinOsc.ar(200) + SinOsc.ar(200 * 1.5) + SinOsc.ar(200 * 2);\n sig * 0.08 }.play;\n```"}, {"role": "assistant", "content": "Three sines at 200, 300 and 400 Hz - a harmonic series with no even partials missing, so it sounds like a hollow, clarinet-ish tone.\n\n- The three frequencies are related by simple integer ratios, which is what makes them fuse into one pitch instead of three.\n- Equal amplitudes on each partial make the timbre buzzy; a roll-off like `1/n` sounds more natural.\n- Summing three full-scale sines would clip, hence the `0.08`."}]} | |
| {"schema": 1, "id": "teacher:read:020", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ SinOsc.ar(440) }.plot;\n```"}, {"role": "assistant", "content": "It draws the first fraction of a second of the signal on screen and makes no sound.\n\n- `.plot` on a function builds the UGen graph and samples it in the language, without involving the server.\n- That is why it works even when the server is not booted: nothing is being synthesised in real time.\n- The window shows a short slice - enough to check a waveform's shape, not to hear it.\n- `.play` is the method that sends the graph to the server; `.plot` is for looking."}]} | |
| {"schema": 1, "id": "teacher:read:021", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPmono(\\bell_synth, \\dur, 0.5, \\note, Pseq([60, 67, 72], inf)).play;\n```"}, {"role": "assistant", "content": "It plays a bell melody on one long-lived Synth, retriggering it every half second instead of starting a new node.\n\n- `Pmono` keeps one Synth alive and sends new values to its controls for each event.\n- That is the difference from `Pbind` with `\\instrument`, which creates a fresh node per note.\n- `\\note` is converted to `\\freq` in Hz by the default event, so the SynthDef needs a `freq` argument to receive it.\n- Use `Pmono` when the sound has state worth keeping - a filter sweep, a grain cloud, a growing envelope."}]} | |
| {"schema": 1, "id": "teacher:read:022", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n~bus = Bus.audio(s, 2);\nSynthDef(\\fx_synth, { |out = 0, in|\n Out.ar(out, FreeVerb.ar(In.ar(in, 2), 0.6, 0.9))\n}).add;\n```"}, {"role": "assistant", "content": "It allocates a two-channel private bus and defines a reverb that reads from it - the standard send-and-return setup, one half at a time.\n\n- `Bus.audio(s, 2)` asks the server for two channels nobody else is writing to.\n- `In.ar(in, 2)` reads those channels; `in` is the argument that will be given the bus number.\n- `Out.ar(out, ...)` sends the reverberated signal to the hardware output, so the effect returns to the mix.\n- This SynthDef must be running before anything writes to the bus, otherwise the reverb is not there to hear it."}]} | |
| {"schema": 1, "id": "teacher:read:023", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Mix.ar(SinOsc.ar([200, 300, 400])) * 0.05 }.play;\n```"}, {"role": "assistant", "content": "It sums three sines into one mono signal rather than spreading them across three channels.\n\n- Without `Mix`, the array `[200, 300, 400]` would expand to three separate output channels.\n- `Mix.ar` adds the elements of a multi-channel signal into a single channel.\n- The result is the same waveform you would get with `+`, but written so the chord can grow from a list.\n- Summing three sines triples the peak, so the amplitude has to come down."}]} | |
| {"schema": 1, "id": "teacher:read:024", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\nRoutine({ 4.do { |i| Synth(\\kick_synth, [amp, 1 - (i * 0.2)]); 0.5.wait } }).play;\n```"}, {"role": "assistant", "content": "Four kick drums half a second apart, each quieter than the last.\n\n- `Routine` is a language-side coroutine: it can pause midway and be resumed by the clock.\n- `0.5.wait` yields for half a second without blocking the interpreter - that is the point of a Routine instead of a loop with `sleep`.\n- `.play` starts it on the current thread's clock.\n- `1 - (i * 0.2)` gives amplitudes 1, 0.8, 0.6, 0.4 as `i` counts 0 to 3, which is a decay written as arithmetic."}]} | |
| {"schema": 1, "id": "teacher:read:025", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nSynthDef(\\bell_synth, { |out = 0, freq = 440, amp = 0.2|\n var partials = [1, 2.76, 5.4, 8.9];\n var sig = Mix(SinOsc.ar(freq * partials) * [1, 0.5, 0.25, 0.12]);\n var env = EnvGen.kr(Env.perc(0.002, 4), doneAction: 2);\n Out.ar(out, (sig * env * amp).dup);\n}).add;\n```"}, {"role": "assistant", "content": "An inharmonic bell: four sines whose frequencies are not whole multiples of the fundamental, which is what makes metal sound like metal.\n\n- The ratios `2.76`, `5.4` and `8.9` come from measured bell partials, not from a harmonic series.\n- The amplitudes `[1, 0.5, 0.25, 0.12]` roll off so the upper partials decay faster in perception.\n- `Env.perc(0.002, 4)` is the strike: 2 ms attack, 4 s decay, so the sound rings.\n- `doneAction: 2` frees the four oscillators as a unit when the envelope closes."}]} | |
| {"schema": 1, "id": "teacher:read:026", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nPbind(\\note, Pseq([60, 64, 67], 1), \\dur, 0.5, \\pan, Pwhite(-1.0, 1.0, 3)).play;\n```"}, {"role": "assistant", "content": "It plays a three-note C major arpeggio once, half a second per note, with each note placed at a random stereo position.\n\n- `Pseq([60, 64, 67], 1)` runs the list exactly once; `inf` would repeat forever.\n- `\\note` is a MIDI note number, which the default event converts to `freq` in Hz.\n- `Pwhite(-1.0, 1.0, 3)` makes exactly three draws, one per note, so the pattern's length matches.\n- `\\pan` goes from -1 (left) to 1 (right) and is read by the `\\default` SynthDef."}]} | |
| {"schema": 1, "id": "teacher:read:027", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var sig = LFSaw.ar(0.2).range(200, 1500); SinOsc.ar(sig) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "A sine whose pitch glides up and down between 200 Hz and 1.5 kHz every five seconds - a siren.\n\n- `LFSaw.ar(0.2)` is a slow sawtooth at 0.2 Hz, so one cycle takes 5 s.\n- A sawtooth ramps up and then jumps down, which is what makes the sweep rise and snap back rather than glide both ways; `LFTri` would sweep both ways.\n- `.range(200, 1500)` maps the -1..1 output onto the frequency range.\n- The outer `SinOsc` is the audible oscillator; everything before it is control."}]} | |
| {"schema": 1, "id": "teacher:read:028", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\ns.boot;\ns.waitForBoot { Synth(\\bell_synth, [freq, 880]) };\n```"}, {"role": "assistant", "content": "It boots the audio server and then starts one bell, only after the server is actually ready.\n\n- `s.boot` is asynchronous: it returns before the server has finished starting.\n- `waitForBoot` schedules its function to run once the server replies that it is running.\n- Without it, `Synth(...)` can be sent to a server that is not up yet and the note is lost with a warning.\n- `[freq, 880]` is an array of control name and value pairs, so the SynthDef's `freq` argument is 880 Hz for this voice."}]} | |
| {"schema": 1, "id": "teacher:read:029", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ Latch.kr(LFNoise0.kr(20), Impulse.kr(3)) }.poll;\n```"}, {"role": "assistant", "content": "It samples a fast random signal only three times a second - a stepped random control, the classic sample-and-hold.\n\n- `LFNoise0.kr(20)` produces a new random value 20 times a second, which is too fast to use as a setting.\n- `Impulse.kr(3)` fires three triggers per second.\n- `Latch` passes its input through only at each trigger and holds the value in between, so the output is piecewise constant.\n- `.poll` prints the values to the post window instead of making sound; `.ar` with an audio input would be a bitcrusher."}]} | |
| {"schema": 1, "id": "teacher:read:030", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var in = Impulse.ar(2); CombN.ar(in, 0.5, 0.5, 3) + in }.play;\n```"}, {"role": "assistant", "content": "A pulse fed into a delay tuned exactly to its own period, so the echoes reinforce it into a buzzing drone.\n\n- `Impulse.ar(2)` fires every half second, and the delay time is also `0.5` s.\n- Each echo lands exactly on the next pulse, so the feedback path keeps adding energy at the same phase.\n- `3` is the decay time in seconds; larger values make the drone ring longer.\n- `+ in` mixes the dry pulse back in, otherwise you only hear the delayed copy."}]} | |
| {"schema": 1, "id": "teacher:read:031", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ Splay.ar(Saw.ar([110, 110.3, 110.6])) * 0.1 }.play;\n```"}, {"role": "assistant", "content": "Three sawtooths detuned by a few cents, spread across the stereo field - a wide, chorused lead.\n\n- The frequencies are close enough to fuse into one pitch but not close enough to be identical, so they beat slowly against each other.\n- `Saw.ar([...])` expands to three mono signals; `Splay.ar` pans them from left to right and sums them into stereo.\n- Without `Splay` the three channels would go out as three separate outputs and a stereo interface would only hear the first two."}]} | |
| {"schema": 1, "id": "teacher:read:032", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\nSynthDef(\\noise_synth, { |out = 0, dur = 0.1|\n var env = EnvGen.kr(Env.perc(0.001, dur), doneAction: 2);\n Out.ar(out, (BPF.ar(WhiteNoise.ar(0.5), 3000, 0.5) * env).dup);\n}).add;\n```"}, {"role": "assistant", "content": "A snare-like hit: filtered noise with a short envelope, and the envelope length is a control.\n\n- `BPF.ar` keeps a band around 3 kHz, which is where a snare's noise sits; broadband white noise would sound like a hiss.\n- The third argument `0.5` is `rq` - wider than a resonance, so the hit sounds natural rather than tonal.\n- `dur` is an argument, so the same SynthDef can produce a 0.1 s snare or a 1 s noise sweep without a second definition.\n- `doneAction: 2` frees the node at the end, so a Pbind can fire this all night."}]} | |
| {"schema": 1, "id": "teacher:read:033", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n~clock = TempoClock.new(2);\nPbind(\\degree, Pseq([0, 3, 5], inf), \\dur, 1).play(~clock);\n```"}, {"role": "assistant", "content": "It plays a repeating three-note figure at two beats per second on its own clock, separate from the default one.\n\n- `TempoClock.new(2)` makes a clock running at 120 BPM, independent of `TempoClock.default`.\n- `\\dur, 1` is one beat of that clock, so each note lasts half a second.\n- `.play(~clock)` runs the pattern on this clock, so changing `TempoClock.default` later will not affect it.\n- Two separate clocks can drift apart on purpose, which is how polymetric music is built."}]} | |
| {"schema": 1, "id": "teacher:read:034", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var sig = Pan2.ar(WhiteNoise.ar(0.1), SinOsc.kr(0.5)); sig }.play;\n```"}, {"role": "assistant", "content": "Noise that slowly moves from left to right and back, one full sweep every two seconds.\n\n- `Pan2.ar(in, pos)` takes a mono signal and returns two channels with the position applied.\n- `SinOsc.kr(0.5)` completes one cycle in 2 s and swings from -1 to 1, which is exactly the pan range.\n- Because the pan is recomputed every block, the movement is smooth rather than stepped.\n- Noise has no pitch, so the panning is the only thing that changes - a useful test signal for checking a stereo path works."}]} | |
| {"schema": 1, "id": "teacher:read:035", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var trig = Dust.kr(8); SinOsc.ar(660) * EnvGen.kr(Env.perc(0.001, 0.05), trig) }.play;\n```"}, {"role": "assistant", "content": "Randomly spaced blips on average eight times a second - a sparse, stochastic pulse.\n\n- `Dust.kr(8)` fires random triggers at an average rate of 8 per second; the gaps are not equal.\n- Using it as the trigger of an `EnvGen` means each blip gets its own envelope, so no two overlap predictably.\n- `Env.perc(0.001, 0.05)` is a 50 ms blip, which is what keeps the grains separate.\n- `Dust` is the standard source for this: it costs nothing and the density is the only control."}]} | |
| {"schema": 1, "id": "teacher:read:036", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this SuperCollider code:\n```supercollider\n{ var sig = SinOsc.ar(300); HPF.ar(sig, 1000) }.play;\n```"}, {"role": "assistant", "content": "It is silent, and that is the correct result: a 300 Hz sine has nothing above 1 kHz for the filter to pass.\n\n- `HPF.ar(in, freq)` attenuates everything below its cutoff.\n- A pure sine at 300 Hz contains energy at 300 Hz only, so a 1 kHz high-pass removes all of it.\n- This is a common cause of a patch that looks right and makes no sound: a filter placed where there is no signal.\n- Change the sine to `Saw.ar(300)` and the same filter passes the harmonics above 1 kHz."}]} | |
| {"schema": 1, "id": "teacher:read:037", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\n{ var sig = SinOsc.ar(440); sig = sig * 0.1; [sig, sig] }.play;\n```"}, {"role": "assistant", "content": "It outputs the same 440 Hz sine on both channels by returning a literal array.\n\n- Returning an array from the function is how a `.play` function declares its channel count.\n- `[sig, sig]` duplicates the same signal, so both channels are identical - true mono content, not stereo.\n- Moving `* 0.1` before the array avoids writing it twice; multiplying the array would do the same thing through multi-channel expansion.\n- Inside a SynthDef the same job is done by `Out.ar(0, sig.dup)`."}]} | |
| {"schema": 1, "id": "teacher:read:038", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\nSynthDef(\\lfo_synth, { |out = 0, freq = 220, amp = 0.2|\n var mod = SinOsc.kr(5, 0, freq * 0.01);\n Out.ar(out, (SinOsc.ar(freq + mod) * amp).dup);\n}).add;\n```"}, {"role": "assistant", "content": "A sine with a gentle vibrato: the modulation depth is one percent of the note's own frequency, so every note wobbles by the same musical amount.\n\n- `SinOsc.kr(5, 0, freq * 0.01)` makes a 5 Hz sine whose amplitude is 1% of `freq`.\n- Adding it to `freq` gives a pitch deviation of about 17 cents at any note, because the depth scales with the note.\n- A fixed depth in Hz would sound wild on a low note and inaudible on a high one.\n- Control rate is enough for a 5 Hz modulator; audio rate would only matter for FM timbres."}]} | |
| {"schema": 1, "id": "teacher:read:039", "family": "T4", "weight": 3, "turns_count": 1, "conversations": [{"role": "user", "content": "Explain this code:\n```supercollider\ns.freeAll;\n```"}, {"role": "assistant", "content": "It stops every node running on the server and leaves the server itself up.\n\n- `s.freeAll` sends `/g_freeAll` to the root group, so every Synth and every group below it is freed at once.\n- The Server object, the sample rate, the loaded SynthDefs and the buffers all survive; only the sounding nodes go.\n- It is the standard panic button when a pattern has left notes ringing or a feedback graph is running away.\n- It does not stop a `Pbind` that is still playing: the pattern will simply start its next synth."}]} | |