Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
supercollider [2021/11/05 18:02] – created julien | supercollider [2021/11/06 13:17] (current) – julien | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== supercollider=code=share ====== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | |||
+ | ===== basics ===== | ||
+ | |||
+ | Oscillator Stereo basics | ||
+ | < | ||
+ | ( | ||
+ | { | ||
+ | // mixing sine oscillators in parallel | ||
+ | var n = 16; // number of structures to make | ||
+ | // mix together | ||
+ | Mix.fill(n, | ||
+ | // this function creates an oscillator at a random frequency | ||
+ | { FSinOsc.ar(200 + 1000.0.rand) } | ||
+ | ) / (2*n) // scale amplitude | ||
+ | }.scope(1); | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | Great Theremin with your mouse | ||
+ | |||
+ | < | ||
+ | #theremin nice sound (ghosty) | ||
+ | ( | ||
+ | { | ||
+ | | ||
+ | freq: MouseY.kr(3200, | ||
+ | SinOsc.kr(6, | ||
+ | mul: abs(MouseX.kr(0.02, | ||
+ | ) | ||
+ | }.play | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | funny crazy bells | ||
+ | < | ||
+ | #bells funny | ||
+ | |||
+ | ( | ||
+ | //frequency linked to envelope length | ||
+ | //high notes short, low long | ||
+ | { | ||
+ | var frequency; | ||
+ | Mix.ar( | ||
+ | { | ||
+ | frequency = rrand(100, 5000); | ||
+ | Pan2.ar( | ||
+ | | ||
+ | frequency, | ||
+ | mul: EnvGen.kr( | ||
+ | | ||
+ | | ||
+ | 0.2 | ||
+ | ) | ||
+ | ), | ||
+ | | ||
+ | ) | ||
+ | | ||
+ | ) | ||
+ | }.play | ||
+ | ) | ||
+ | </code | ||
+ | |||
+ | ===== composition ===== | ||
+ | |||
+ | Found codes to glitch it! | ||
+ | |||
+ | < | ||
+ | # | ||
+ | |||
+ | |||
+ | ( | ||
+ | { | ||
+ | var h, n, m, k, trig; | ||
+ | | ||
+ | h = ToggleFF.kr(CoinGate.kr(0.4, | ||
+ | RLPF.ar(LFPulse.ar(50, | ||
+ | n = Trig.ar(trig, | ||
+ | m = Trig.ar(trig, | ||
+ | k = Trig.ar(trig, | ||
+ | LFClipNoise.ar(LFNoise0.kr(7, | ||
+ | LeakDC.ar(h + n + k + m * 10).distort; | ||
+ | }.play; | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | ===== Live coding ===== | ||
+ | |||
+ | Bases of live coding: | ||
+ | |||
+ | < | ||
+ | p = ProxySpace.push; | ||
+ | </ | ||
+ | |||
+ | |||
+ | some simple live code to get in | ||
+ | |||
+ | < | ||
+ | code:: | ||
+ | d = (); // create a new environment | ||
+ | d.push; // push it to current | ||
+ | |||
+ | // this synthdef can be changed on the fly, but the synth will | ||
+ | // not change from this. use expression [1] for replacing a given synth | ||
+ | ( | ||
+ | SynthDef(\x, | ||
+ | Out.ar(out, | ||
+ | Ringz.ar(Dust.ar(40), | ||
+ | ) | ||
+ | }).send(s) | ||
+ | ) | ||
+ | |||
+ | // send a first synth: | ||
+ | ~s1 = Synth(\x); | ||
+ | |||
+ | // [1] | ||
+ | // now you can play around with these lines, as well as with the synth def above | ||
+ | ~s1 = Synth.replace(~s1, | ||
+ | ~s1.set(\freq, | ||
+ | |||
+ | // add a bus: | ||
+ | |||
+ | ~b1 = Bus.control(s); | ||
+ | ~b1.set(350); | ||
+ | ~s1.map(\freq, | ||
+ | |||
+ | // set the bus to different values: | ||
+ | |||
+ | ~b1.set(100); | ||
+ | ~b1.xline(800, | ||
+ | |||
+ | ~s3 = { Out.kr(~b1, MouseX.kr(300, | ||
+ | ~s3.free; // remove it again. | ||
+ | |||
+ | |||
+ | |||
+ | // finish: | ||
+ | |||
+ | ~b1.free; | ||
+ | d.clear; | ||
+ | d.pop; | ||
+ | :: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Music with beats ===== | ||
+ | |||
+ | basic techno (nice) | ||
+ | |||
+ | < | ||
+ | ( | ||
+ | play{ | ||
+ | i=Impulse.ar(_); | ||
+ | h = LPF.ar(WhiteNoise.ar(Decay.ar(Impulse.ar([1, | ||
+ | Limiter.ar( | ||
+ | (z=Pluck.ar(Saw.ar(4), | ||
+ | + LPF.ar(HPF.ar(FreeVerb.ar(z.mean, | ||
+ | + HPF.ar(Ringz.ar(LPF.ar(Impulse.ar([0.5, | ||
+ | + h + RHPF.ar(CombL.ar(h*0.4, | ||
+ | ) | ||
+ | } | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | |||