├── 240630
├── Machi_baseColor.jpeg
├── draw-model.lisp
├── model.lisp
├── scene.bin
└── scene.gltf
├── 230204.csd
├── 240318.csd
├── 240531.lisp
├── 240610.scd
├── 240806.scd
├── 240824.csd
├── 240826.lisp
├── 240901.scd
├── 240906.csd
├── 241228.scd
├── README.md
└── samples
├── 240901-aalto.fxp
├── hihat.wav
├── hihat1.aif
├── kick.wav
├── kick1.aif
├── rain1.ogg
├── snare.wav
└── snare2.wav
/230204.csd:
--------------------------------------------------------------------------------
1 |
2 |
3 | -odac -m4
4 |
5 |
6 |
7 | sr = 44100
8 | ksmps = 10
9 | nchnls = 2
10 | 0dbfs = 1.0
11 | seed 0
12 |
13 | gkTempo init (113 / 60) * 4
14 |
15 | giSin ftgen 1, 0, 1024, 10, 1
16 | giSample ftgen 2, 0, 0, 1, "samples/kick1.aif", 0, 4, 1
17 |
18 |
19 | schedule "clock", 0, -1
20 | schedule "reverb", 0, -1
21 |
22 | instr clock
23 | ktrig metro gkTempo
24 | kcount init 0
25 | if ktrig == 1 then
26 | schedulek "schedule", .0, .1, kcount
27 | kcount += 1
28 | endif
29 | endin
30 |
31 | instr schedule
32 | icount = p4
33 | if icount % 1 == 0 then
34 | schedule "_init_sound", .0, .3
35 | schedule "_bass", .0, .3
36 | endif
37 | if icount % 1 == 0 then
38 | schedule "_hihat", .0, random(.03, .13)
39 | endif
40 | if icount % 4 == 0 then
41 | schedule "_init_sound", .0, (1/i(gkTempo)) * 6.
42 | schedule "_kick", .0, 1.0
43 | endif
44 | endin
45 |
46 | instr _init_sound
47 | ifreq = 110 * int(random(1,3))
48 | iratio = .5 * int(random(1,14))
49 | indx = 2.
50 | iattk = random(.0, 1.0) > .5 ? .001 : .9
51 | aenv linseg .0, p3*iattk, .2, p3*(1-iattk), .0
52 | amod oscil ifreq * iratio * indx, ifreq * iratio
53 | asig oscil aenv, ifreq + amod
54 | al, ar pan2 asig, .5 + random(-.4, .4)
55 | outs al, ar
56 | chnmix al*.3, "reverbL"
57 | chnmix ar*.3, "reverbR"
58 | endin
59 |
60 | instr _kick
61 | aindx line .0, p3, ftsr(giSample)*p3
62 | asig table aindx, giSample
63 | asig = asig*.7
64 | outs asig, asig
65 | endin
66 |
67 | instr _hihat
68 | asig noise line:a(.24, p3, .0), .0
69 | outs asig, asig
70 | endin
71 |
72 | instr _bass
73 | asig vco line:a(.2, p3, .0), 110, 1, 0, giSin
74 | asig = lowpass2(asig, 400 + 400*int(random(1,10)), 4)
75 | outs asig, asig
76 | chnmix asig*.2, "reverbL"
77 | chnmix asig*.2, "reverbR"
78 | endin
79 |
80 | instr reverb
81 | al, ar reverbsc chnget:a("reverbL"), chnget:a("reverbR"), .9, 12000
82 | outs al, ar
83 | chnclear "reverbL", "reverbR"
84 | endin
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/240318.csd:
--------------------------------------------------------------------------------
1 |
2 |
3 | -odac -m4
4 |
5 |
6 |
7 | sr = 44100
8 | ksmps = 256
9 | nchnls = 2
10 | 0dbfs = 1.0
11 | seed 0
12 |
13 | gkTempo init 60
14 | gkResolution init 48
15 |
16 | #define METRO(N) # (i(gkResolution) / (1 / ($N))) #
17 |
18 | gaRevL init 0
19 | gaRevR init 0
20 | gaDelL init 0
21 | gaDelR init 0
22 |
23 | gkRain init .6
24 |
25 |
26 |
27 | schedule "reverb", 0, -1
28 | schedule "delay", 0, -1
29 | schedule "clock", 0, -1
30 | schedule "rain", 0, -1
31 |
32 |
33 |
34 |
35 | instr rain
36 | kenv lag gkRain, 8.0
37 | al, ar diskin "samples/rain1.ogg", 1, 0, 1
38 | outs al*kenv, ar*kenv
39 | endin
40 |
41 |
42 | instr clock
43 | ktrig metro gkTempo / 60 * gkResolution
44 | kcount init 0
45 | if ktrig == 1 then
46 | schedulek "schedule", .0, .1, kcount
47 | kcount += 1
48 | endif
49 | endin
50 |
51 |
52 | instr schedule
53 | icount = p4
54 | iscale[] fillarray 0, 2, 4, 6, 7, 9, 11
55 | if icount % $METRO(4) == 0 then
56 | schedule "sawPad", 0, 6, 48
57 | schedule "sawPad", 0, 6, 67
58 | schedule "sawPad", 0, 6, 71
59 | schedule "ambient", 0, 6, 48
60 | schedule "ambient", 0, 6, 55
61 | schedule "ambient", 0, 6, iscale[random(0, lenarray(iscale))] + 60
62 | schedule "ambient", 0, 6, iscale[random(0, lenarray(iscale))] + 72
63 | endif
64 | if icount % $METRO(1) == 0 && rnd(1.0) > .3 then
65 | schedule "bell", 0, 4, iscale[random(0, lenarray(iscale))] + 72
66 | endif
67 | if icount % $METRO(8) == 0 then
68 | schedule "pulse", 0, .1, 67
69 | schedule "pulse", 4, .1, 67
70 | imax = floor(random(3, 8))
71 | icnt = 0
72 | while icnt < imax do
73 | schedule "pulse", 7 + ((1/imax)*icnt), .1, iscale[random(0, lenarray(iscale))] + 72
74 | icnt = icnt + 1
75 | od
76 | endif
77 | endin
78 |
79 |
80 | instr pulse
81 | kenv line .1, p3, .0
82 | asig vco2 kenv, cpsmidinn(p4), 2, .5
83 | outs asig, asig
84 | gaRevL += asig*.3
85 | gaRevR += asig*.3
86 | gaDelL += asig*.3
87 | gaDelR += asig*.3
88 | endin
89 |
90 |
91 | instr bell
92 | kenv line .036, p3, .0
93 | ifreq = cpsmidinn(p4)
94 | a1 foscil kenv, ifreq, 1, 1, .7
95 | a2 foscil kenv, ifreq, 1, 7, .7
96 | a3 foscil kenv, ifreq, 1, 14, .7
97 | asig = (a1 + a2 + a3) * .7
98 | outs asig, asig
99 | gaRevL += asig*.3
100 | gaRevR += asig*.3
101 | gaDelL += asig*.3
102 | gaDelR += asig*.3
103 | endin
104 |
105 |
106 | instr sawPad
107 | kenv linseg .0, p3*.2, .02, p3*.6, .02, p3*.2, .0
108 | ifreq = cpsmidinn(p4)
109 | al vco2 kenv*2, ifreq
110 | ar vco2 kenv*2, ifreq + 2
111 | outs butterlp(al, 1000), butterlp(ar, 1000)
112 | endin
113 |
114 |
115 | instr ambient
116 | kenv linseg .0, p3*.2, .02, p3*.6, .02, p3*.2, .0
117 | ifreq = cpsmidinn(p4)
118 | a1 foscil kenv, ifreq, 1, 1, 1
119 | a2 foscil kenv, ifreq, 1, 2, .7
120 | a3 foscil kenv, ifreq, 1, 7, .4
121 | klfo randi .3, .4
122 | klfo = abs(klfo) + .3
123 | a4 foscil kenv*klfo, ifreq, 1, 14, .3
124 | amod oscil 1000, 4000
125 | a5 oscil kenv, ifreq + amod
126 | asig = (a1 + a2 + a3 + a4 + a5) * 1.4
127 | al, ar pan2 asig, oscil:k(.3, .4) + .5
128 | outs al, ar
129 | gaRevL += al*.3
130 | gaRevR += ar*.3
131 | endin
132 |
133 |
134 | instr reverb
135 | al, ar reverbsc gaRevL, gaRevR, .9, 12000
136 | outs al, ar
137 | gaRevL = 0
138 | gaRevR = 0
139 | endin
140 |
141 |
142 | instr delay
143 | al vdelay gaDelL, 60/gkTempo * (1000/2), 4000
144 | ar vdelay gaDelR, 60/gkTempo * (1000/3), 4000
145 | outs al, ar
146 | gaDelL = al * .3
147 | gaDelR = ar * .3
148 | endin
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/240531.lisp:
--------------------------------------------------------------------------------
1 |
2 | ;; ================================================================================
3 | ;; load system
4 |
5 | ;; Need Common Music package. You can get it
6 | ;; https://github.com/byulparan/CommonMusic2
7 | ;; or
8 | ;; https://github.com/ormf/cm
9 |
10 | (ql:quickload '(:cl-audiovisual :cm))
11 |
12 | ;; ================================================================================
13 | ;; define packages
14 | (in-package :sc-user)
15 | (named-readtables:in-readtable :sc)
16 | (use-package '(:sc-extensions :glsl))
17 |
18 |
19 | ;; ================================================================================
20 | ;; bootup scsynth server
21 | (av:run-cl-collider)
22 |
23 |
24 | (bpm 160.0)
25 |
26 | ;; ================================================================================
27 | ;; load sample
28 | (defvar *hihat* (buffer-read-channel "./samples/hihat.wav" :channels [0]))
29 | (defvar *kick* (buffer-read-channel "./samples/kick.wav" :channels [0]))
30 | (defvar *snare* (buffer-read-channel "./samples/snare.wav" :channels [0]))
31 | (defvar *snare2* (buffer-read-channel "./samples/snare2.wav" :channels [0]))
32 |
33 |
34 | ;; reverb bus
35 | (defvar *reverb-bus* (bus-audio :chanls 2))
36 |
37 |
38 | ;; ================================================================================
39 | ;; define synth and effect
40 |
41 | (proxy :main-mix
42 | (replace-out.ar 0 (* .5 (in.ar 0 2)))
43 | :to 0
44 | :pos :tail)
45 |
46 | (proxy :reverb
47 | (g-verb.ar (in.ar *reverb-bus* 2) 100 6.0)
48 | :to 1
49 | :pos :after)
50 |
51 | (defsynth sample (bufnum (start 0) (end 1) (rate 1) (gain 1))
52 | (let* ((dur (* (buf-dur.ir bufnum) (abs (- end start))))
53 | (sig (pan2.ar (buf-rd.ar 1 bufnum (* (line.ar start end (* dur (reciprocal rate)) :act :free)
54 | (buf-frames.ir bufnum))))))
55 | (setf sig (* sig gain))
56 | (out.ar 0 sig)))
57 |
58 | (defsynth fm ((freq 440) (ratio 1) (indx 0) (mod 0 :ar) (dur 1.0) (attk 0) (rel .01) (pan .0) (amp 1.0) (reverb .0))
59 | (let* ((env (env-gen.kr (env [0 .2 .2 0] (* dur [attk (- 1.0 (+ attk rel)) rel])) :act :free))
60 | (sig (pan2.ar (pm-osc.ar freq (* freq ratio) indx mod (* amp env)) pan)))
61 | (out.ar 0 sig)
62 | (out.ar *reverb-bus* (* sig reverb))))
63 |
64 |
65 |
66 | ;; ================================================================================
67 | ;; Graphics
68 |
69 |
70 | (gfx:clear-pipeline)
71 |
72 | (gfx:defvar-g eps .001)
73 | (gfx:defvar-g max-step 100)
74 | (gfx:defvar-g max-depth 100.0)
75 | (gfx:defvar-g objcol (vec3 .0))
76 |
77 | (gfx:defun-g rot ((a :float))
78 | (let* ((s (sin a))
79 | (c (cos a)))
80 | (m! c s (- s) c)))
81 |
82 | (gfx:defun-g sdf ((pos :vec3))
83 | (let* ((d 40.0)
84 | (s 2.0)
85 | (p (vec3 .0)))
86 | (setf (xz pos) (* (xz pos) (rot (+ itime .5))))
87 | (setf (y pos) (- (y pos) 8.0))
88 | (setf (yz pos) (* (yz pos) (rot itime)))
89 | (setf p (- (abs pos) (* ivolume0 2.0)))
90 | (setf d (min d (- (length p) .5)))
91 | (setf d (min d (max (- (length (* 1.0 (xz p))) .1) (y p))))
92 | (setf d (min d (max (- (length (* 1.0 (yz p))) .1) (x p))))
93 | (setf d (min d (max (- (length (* 1.0 (xy p))) .1) (z p))))
94 | (setf p (abs pos))
95 | (setf (x p) (- (x p) 4.0))
96 | (setf d (min d (- (length p) .7)))
97 | (setf d (min d (max (- (length (yz p)) .1) (x p))))
98 | (setf d (min d (length (- (yz p)
99 | (abs (* (sin (- (* (x p) .5)
100 | (* itime 10.0)))
101 | .8))))))
102 | (setf p (abs pos))
103 | (setf (y p) (- (y p) 4.0))
104 | (setf d (min d (- (length p) .7)))
105 | (setf d (min d (- (length (xz p)) .1)))
106 | (setf d (min d (length (- (xz p)
107 | (abs (* (sin (- (* (y p) .5)
108 | (* itime 10.0)))
109 | .8))))))
110 | (setf objcol (v! 1.0 1.0 1.0))
111 | d))
112 |
113 | (gfx:define-shader graphics
114 | (sl:with-raymarch (uv rd (ro camera) (ta lookat) uvn 2.0)
115 | (let* ((col (vec3 0.0))
116 | (md 0.0))
117 | (dotimes (i 100)
118 | (let* ((p (+ ro (* rd md)))
119 | (d (sdf p)))
120 | (setf d (max .01 (abs d)))
121 | (incf md d)
122 | (when (> md max-depth) (break))
123 | (incf col (* .01 objcol))))
124 | (+
125 | (* .4 (sl:texture! ichannel0 uvn))
126 | (v! (* 4.0 ivolume0 (pow col (vec3 2.0))) 1.0)))))
127 |
128 |
129 |
130 |
131 | (gfx:start-shader graphics
132 | :textures ((:previous-frame)))
133 |
134 | (gfx:move-camera :eye-x 0.0 :eye-y 4.0 :eye-z 15.0 :center-y 6.0)
135 |
136 |
137 | ;; ================================================================================
138 | ;; Sound
139 |
140 | (schedule drumkit (1)
141 | (with-lambda (1/4)
142 | (when (cm:odds .5)
143 | (pp 'sample :bufnum *hihat* :gain .6))
144 | (case (beat-count 16)
145 | ((0 6 10) (pp 'sample :bufnum *kick*))
146 | ((4 12) (pp 'sample :bufnum *snare* :gain 1.3))
147 | (t (when (cm:odds .4)
148 | (dotimes (i (if (cm:odds .9) 1 2))
149 | (pp (* i 1/8) 'sample :bufnum *snare2* :gain .3 :end (trunc (rrand .5 1.0) .1) :rate (trunc (rrand .9 1.1) .1))))))))
150 |
151 |
152 | (schedule bass (16)
153 | (with-lambda ((cm:next #.(cm:new cm:cycle :of [1.5 1.5 1])))
154 | (pp 'fm :freq (midicps (nth-beat 16 [41 40])) :ratio .5 :indx 1. :dur (* dur .8) :amp 1.3)))
155 |
156 |
157 | (schedule pad (16)
158 | (with-lambda (16)
159 | (dolist (freq (midicps [55 60 64 (pc:quantize (rrand 67 76))]))
160 | (loop for detune in [0 2]
161 | for pan in [-1 1]
162 | do
163 | (pp 'fm :freq (+ freq detune) :indx 1. :dur 22 :attk .3 :rel .3 :amp .6 :reverb .1
164 | :pan pan)))))
165 |
166 |
167 |
168 |
169 |
--------------------------------------------------------------------------------
/240610.scd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | (
5 | ~reverbBus = Bus.audio(s, 2);
6 |
7 | {
8 | GVerb.ar(In.ar(~reverbBus,2), 100, 6);
9 | }.play(s, target: 1, addAction: \addAfter);
10 |
11 | Ndef(\fm).quant_(1).play;
12 | )
13 |
14 |
15 |
16 |
17 | (
18 | Ndef(\fm)[0] = {
19 | var trig = \trig.tr(0);
20 | var env = Env([0.0, 0.25, 0.0],[0.0, 1.0]).kr(0, trig);
21 | var freq = Env([0.1, 200, 20], [0.0, 0.1], \exp).kr(0, trig);
22 | var mod = SinOsc.ar(\modFreq.kr(100));
23 | var sig = Pan2.ar(PMOsc.ar(freq, freq*\ratio.kr(1), \indx.kr(1), mod, env));
24 | Out.ar(~reverbBus, sig*\rev.kr(0));
25 | sig
26 | }
27 | )
28 |
29 | (
30 | Ndef(\fm)[1] = \set->Pbind(
31 | \ratio, 2**Pwhite(0,4),
32 | \indx, Pwhite(1,10),
33 | \modFreq, 2**Pwhite(1, 20),
34 | \rev, Pif(0.7.loop.coin, 0.0, Pwhite(0.1, 0.3).trunc(0.1)),
35 | \dur, Pif(0.7.loop.coin, Pwhite(1,2)*0.125, Rest(0.125))
36 | )
37 | )
38 |
39 |
40 | (
41 | SynthDef(\pwm_pad, {|freq = 100, dur=4.0, cutoff=1000|
42 | var env = Env([0.0, 0.1, 0.1, 0.0], dur*[0.3, 0.4, 0.3]).kr(2);
43 | var pw = SinOsc.ar(55.midicps, 0, 0.4, 0.5);
44 | var sig = RLPF.ar(LFPulse.ar(freq +[0,2], 0, pw, 2, -1) * env, cutoff);
45 | Out.ar(0, sig);
46 | Out.ar(~reverbBus, sig*0.1);
47 | }).add;
48 | )
49 |
50 | (
51 | Pbindef(\pad,
52 | \instrument, \pwm_pad,
53 | \midinote, Ptuple([48,55,Pxrand([65,67,71,74],inf)],inf),
54 | \dur, 6.0,
55 | \delta, 4.0
56 | ).play;
57 | )
58 |
59 |
60 |
--------------------------------------------------------------------------------
/240630/Machi_baseColor.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/240630/Machi_baseColor.jpeg
--------------------------------------------------------------------------------
/240630/draw-model.lisp:
--------------------------------------------------------------------------------
1 | (in-package :sc-user)
2 | (named-readtables:in-readtable :sc)
3 |
4 |
5 | (gfx:defpipeline draw-scene ((mvp :mat4) (itime :float) (bones :mat4 200) (material :sampler-2d))
6 | (:vertex (:in ((pos :vec3) (coord :vec2) (norm :vec3) (bone-ids :vec4 2) (bone-weights :vec4 2))
7 | :out ((v-pos :vec3) (v-coord :vec2) (v-norm :vec3) ))
8 | (let* ((bone-transform (m! 1.0 0.0 0.0 0.0
9 | 0.0 1.0 0.0 0.0
10 | 0.0 0.0 1.0 0.0
11 | 0.0 0.0 0.0 1.0)))
12 | (setf bone-transform (* (aref bones (int (x (aref bone-ids 0)))) (x (aref bone-weights 0))))
13 | (incf bone-transform (* (aref bones (int (y (aref bone-ids 0)))) (y (aref bone-weights 0))))
14 | (incf bone-transform (* (aref bones (int (z (aref bone-ids 0)))) (z (aref bone-weights 0))))
15 | (incf bone-transform (* (aref bones (int (w (aref bone-ids 0)))) (w (aref bone-weights 0))))
16 | (incf bone-transform (* (aref bones (int (x (aref bone-ids 1)))) (x (aref bone-weights 1))))
17 | (incf bone-transform (* (aref bones (int (y (aref bone-ids 1)))) (y (aref bone-weights 1))))
18 | (incf bone-transform (* (aref bones (int (z (aref bone-ids 1)))) (z (aref bone-weights 1))))
19 | (incf bone-transform (* (aref bones (int (w (aref bone-ids 1)))) (w (aref bone-weights 1))))
20 | (setf v-pos (xyz (* (sl:scale (vec3 .009)) bone-transform (v! pos 1.0)))
21 | v-coord coord
22 | v-norm (normalize (xyz (* bone-transform (v! norm 0.0)))))
23 | (* mvp (v! v-pos 1.0))))
24 | (:fragment (:in ((v-pos :vec3) (v-coord :vec2) (v-norm :vec3)))
25 | (let* ((li (v! 0.0 10.0 10.0))
26 | (l (normalize (- li v-pos)))
27 | (dif (* 1.6 (max (dot v-norm l) 0.0)))
28 | (amb (v! .1 .1 .1)))
29 | (v! (+ amb (* 1.0 (s~ (sl:texture! material (+ v-coord (* .0 itime)) t)
30 | xyz))) 1.0))))
31 |
32 |
33 |
34 | (defclass scene-view (gfx:gl-canvas)
35 | ())
36 |
37 | (defmethod gfx:draw ((view scene-view))
38 | (let* ((w (gfx:width view))
39 | (h (gfx:height view)))
40 | (gl:viewport 0 0 w h)
41 | (gl:clear-color .0 .0 .0 1.0)
42 | (gl:enable :depth-test)
43 | (gl:clear :color-buffer-bit :depth-buffer-bit)
44 | (let* ((mvp (sb-cga:matrix* (gfx:projection-matrix view)
45 | (gfx:view-matrix view)))
46 | (meshes (gfx:model-meshes *model*))
47 | (time (gfx:get-internal-seconds)))
48 | (gfx:animation *model* *animation* (av:get-data :icontrol0))
49 | (loop for mesh in (gfx:model-meshes *model*)
50 | for i from 0
51 | when (gfx:mesh-bones mesh)
52 | do
53 | (gfx:with-shader (view 'draw-scene (gfx:mesh-gpu-stream mesh))
54 | (let* ((bone-transforms (gfx:mesh-bone-transforms mesh)))
55 | (gfx:set-uniform 'mvp mvp)
56 | (gfx:set-uniform 'itime time)
57 | (gfx:set-uniform 'bones bone-transforms)
58 | (gfx:set-uniform 'material 0)
59 | (%gl:draw-elements :triangles
60 | (gfx:gpu-stream-length (gfx:mesh-gpu-stream mesh))
61 | :unsigned-int 0)))))))
62 |
63 |
64 |
65 | (gfx:define-shader scene
66 | (vec4 .0))
67 |
68 |
--------------------------------------------------------------------------------
/240630/model.lisp:
--------------------------------------------------------------------------------
1 | ;;
2 | ;;
3 | ;; Now, cl-glsl works with classimp. but classimp not support recently version of assimp.
4 | ;; so I build assimp v5.2.5 and use it.
5 | ;;
6 | ;; Model from https://sketchfab.com/3d-models/iclone-7-raptoid-mascot-free-download-56a3e10a73924843949ae7a9800c97c7
7 | ;;
8 |
9 |
10 | ;; packages
11 | (ql:quickload '(:cl-audiovisual))
12 | (in-package :sc-user)
13 | (named-readtables:in-readtable :sc)
14 | (use-package '(:glsl :sc-extensions))
15 |
16 |
17 | ;; bootup scsynth
18 | (av:run-cl-collider :monitor-rate 100.0)
19 |
20 |
21 | ;; graphics setup
22 | (defparameter *model* (gfx:load-model "./scene.gltf"))
23 |
24 | (defvar *animation* 0)
25 |
26 | (defun select-animation (index)
27 | (setf *animation* index)
28 | (av:set-data :icontrol1 index))
29 |
30 | (load "draw-model.lisp")
31 |
32 | (gfx:start-shader scene
33 | :textures (("./Machi_baseColor.jpeg"))
34 | :gl-canvas scene-view)
35 |
36 | (gfx:move-camera :eye-x 3.4 :eye-y 1.2 :eye-z 2.5
37 | :center-x .3 :center-y .5 :center-z -.5)
38 |
39 |
40 |
41 |
42 |
43 | (define-code time-trig (time index)
44 | (let* ((timeline (mod (in.kr av:*icontrol0*)
45 | (ai:duration (aref (ai:animations (gfx:model-scene *model*)) index)))))
46 | (* (< time timeline)
47 | (> (+ time .2) timeline)
48 | (= index (in.kr av:*icontrol1*)))))
49 |
50 |
51 | ;; scene 0
52 | (proxy :idle
53 | (pan2.ar
54 | (mix
55 | (+ (pm-osc.ar 100 700 1 .0 (env.kr .3 .6 .3 (time-trig 3.0 0) .1))
56 | (pm-osc.ar 2000 700 1 .0 (env.kr .3 .1 .3 (time-trig 4.7 0) .1))
57 | (pm-osc.ar 100 100 1 .0 (env.kr .3 1.1 .3 (time-trig 5.5 0) .1))
58 | (pm-osc.ar (r+ (lf-pulse.kr 6.) 200 400) 100 1 .0
59 | (env.kr .3 1.1 .6 (time-trig 6.5 0) .1))
60 | (let* ((glow-trig (time-trig 8.6 0)))
61 | (pm-osc.ar 100 (t-line.kr 50 300 1.0 glow-trig) 1 (sin-osc.ar 500 0 .4)
62 | (env.kr .3 1.0 .2 glow-trig .1)))))))
63 |
64 |
65 |
66 |
67 | ;; scene 1
68 | (proxy :grawling
69 | (let* ((trig (time-trig .1 1))
70 | (glow-trig (time-trig 1. 1))
71 | (freq [100 (ti-rand.kr 120 150 trig) (ti-rand.kr 200 600 trig)])
72 | (ratio (r+ (sin-osc.kr .3) 1 4))
73 | (indx (t-line.kr 1 4 1 glow-trig))
74 | (mod (sin-osc.ar 3000 .0 (t-line.kr .1 1. .4 glow-trig) ))
75 | (env (* (env.kr .0 1.2 .1 glow-trig .1)
76 | (asr.kr 1 1 1 (= (in.kr av:*icontrol1*) 1)))))
77 | (pan2.ar
78 | (mix
79 | (+ (pm-osc.ar (* freq (t-line.kr .5 1 .6 trig)) freq 1 .0 (env.kr .3 .6 .3 trig .1))
80 | (pm-osc.ar freq (* freq ratio) indx mod env))))))
81 |
82 |
83 | ;; scene 2
84 | (proxy :scared
85 | (pan2.ar
86 | (mix
87 | (+
88 | (let* ((trig (+ (time-trig .4 2) (time-trig 1.0 2))))
89 | (pm-osc.ar (ti-rand.kr 100 1000 trig) (t-line.kr 100 1000 1. trig) 1. (sin-osc.ar 200)
90 | (env.kr .0 .2 .1 trig .1)))
91 | (let* ((trig (time-trig .8 2)))
92 | (pm-osc.ar (ti-rand.kr 600 1000 trig) (t-line.kr 1000 100 1.3 trig) 1. 0
93 | (* (env.kr .8 1.3 .1 trig .04) (abs (lf-tri.kr 4.3)))))
94 | (let* ((trig (time-trig 4.0 2)))
95 | (pm-osc.ar (ti-rand.kr 500 1000 trig) (t-line.kr 100 1000 1.2 trig) 1.
96 | (sin-osc.ar 5200 .0 (lf-pulse.kr 7.1))
97 | (env.kr .0 1.2 .7 trig .1)))))))
98 |
99 |
100 | ;; scene 3
101 | (proxy :running
102 | (let* ((trig (+ (time-trig .1 3)
103 | (time-trig .5 3)))
104 | (freq (t-line.kr 220 40 .1 trig :exp)))
105 | (pan2.ar (mix (pm-osc.ar freq (* freq (ti-rand.kr 1 4 trig))
106 | (t-line.kr 1 (t-rand.kr 1.4 2.2 trig) .02 trig) 0
107 | (env.kr .0 .6 .1 trig .1))))))
108 |
109 |
110 |
111 |
112 |
113 | ;;
114 | ;; Jam!
115 | ;;
116 | (proxy :run-timestamp
117 | (out.kr av:*icontrol0* (var-lag.kr (cnt 1) (div 1))))
118 |
119 |
120 |
121 | (select-animation 0)
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/240630/scene.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/240630/scene.bin
--------------------------------------------------------------------------------
/240806.scd:
--------------------------------------------------------------------------------
1 | //
2 | // 2024.08.06 byulparan@gmail.com
3 | //
4 | //
5 | (
6 | ~extBus = Bus.audio(s, 2);
7 | ~buffer1 = Buffer.alloc(s, s.sampleRate);
8 | ~buffer2 = Buffer.alloc(s, s.sampleRate);
9 | )
10 |
11 |
12 | (
13 | SynthDef(\vst_inst, {
14 | var sig = VSTPlugin.ar(nil, 2);
15 | Out.ar(0, sig);
16 | Out.ar(~extBus, sig);
17 | }).add;
18 |
19 | SynthDef(\record, {|dur=1,buffer=0|
20 | RecordBuf.ar(Mix(In.ar(~extBus, 2)), buffer);
21 | Line.kr(0,0,dur,doneAction: Done.freeSelf);
22 | }).add;
23 |
24 | SynthDef(\player, {|dur=1, rate=1, pan=0, buffer=0, gain=1, cutoff=10000|
25 | var sig = RLPF.ar(PlayBuf.ar(1, buffer, rate), cutoff);
26 | Line.kr(0,0,dur,doneAction: Done.freeSelf);
27 | Out.ar(0, Pan2.ar(sig*gain, pan));
28 | }).add;
29 | )
30 |
31 |
32 | ~piano = VSTPluginController(Synth(\vst_inst)).open("Pianoteq 8.vst");
33 |
34 |
35 |
36 |
37 |
38 | Pdef.defaultQuant_(4);
39 |
40 | (
41 | p = Pbind(
42 | \type, \vst_midi,
43 | \vst, ~piano,
44 | \scale, Scale.phrygian,
45 | )
46 | )
47 |
48 | (
49 | Pbindf(p,
50 | \midicmd, \control,
51 | \ctlNum, 64,
52 | \control, Pseq([0,127],inf),
53 | \dur, Pseq([1/16, 63/16],inf),
54 | \timingOffset, 0.1
55 | ).play(quant:4);
56 | )
57 |
58 |
59 | (
60 | Pdef(\glit,
61 | Pbind(
62 | \instrument, Pstep(Pseq([\record, \player],inf), Pseq([1/4, 6/8],inf)),
63 | \buffer, ~buffer1,
64 | \addAction, \addToTail,
65 | \pan, Pstep(Pwhite(-1.0, 1.0), 1/2),
66 | \dur, 1/2
67 | )
68 | ).play;
69 |
70 |
71 | Pdef(\glit2,
72 | Pbind(
73 | \instrument, Pstep(Pseq([\record, \player],inf), Pseq([1/2, 28/8],inf)),
74 | \buffer, ~buffer2,
75 | \addAction, \addToTail,
76 | \cutoff, 100 * pow(2, Pwhite(0, 5)),
77 | \rate, Pif(0.8.loop.coin, 1, 2),
78 | \gain, 0.7,
79 | \dur, 1/2
80 | )
81 | ).play;
82 | )
83 |
84 |
85 |
86 |
87 | (
88 | Pdef(\lh,
89 | Pbindf(p,
90 | \octave, 4,
91 | \degree, Ptuple([-7, Pwhite(2,4), Pwhite(5, 9), Pwhite(10, 14)]),
92 | \amp, Pwhite(0.2,0.3),
93 | \dur, 1,
94 | \delta, 4,
95 | )
96 | ).play
97 | )
98 |
99 |
100 | (
101 | Pdef(\rh,
102 | Pbindf(p,
103 | \octave, Pwhite(4,5),
104 | \degree, Pwhite(5,15),
105 | \amp, Pwhite(0.25,0.35),
106 | \dur, Pstep(Prand([1,Rest(1)],inf),1),
107 | )
108 | ).play
109 | )
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/240824.csd:
--------------------------------------------------------------------------------
1 |
2 |
3 | -odac -m4 --port=10000
4 |
5 |
6 |
7 | sr = 44100
8 | ksmps = 32
9 | nchnls = 2
10 | 0dbfs = 1.0
11 | seed 0
12 |
13 |
14 | gkBPM init 116
15 |
16 | gaRevL init 0
17 | gaRevR init 0
18 | gaDelL init 0
19 | gaDelR init 0
20 |
21 |
22 | giKick ftgen 1, 0, 0, -1, "samples/kick1.aif", 0, 4, 1
23 | giHihat ftgen 2, 0, 0, -1, "samples/hihat1.aif", 0, 4, 1
24 | giWave1 ftgen 3, 0, 8192, 10, 1, 0.5, 0.3, 0.2, 0.3, 0.2, 0.4
25 |
26 |
27 | schedule "reverb", 0, -1
28 | schedule "delay", 0, -1
29 | schedule "schedule", 1, 0.1, 0
30 |
31 |
32 | instr schedule
33 | ibeat = p4
34 | ibeatDur = 60/i(gkBPM)
35 |
36 | ;; ================================================================================
37 | ;; Kick Drum
38 | ;; ================================================================================
39 |
40 | if ibeat % 1 == 0 then
41 | schedule "sample_player", .0, .2, giKick, .3
42 | endif
43 |
44 | ;; ================================================================================
45 | ;; Hihat Drum
46 | ;; ================================================================================
47 |
48 | if rnd(1) < .7 then
49 | schedule "sample_player", .0, .02 * pow(2, int(random(0, 4))), giHihat, .13
50 | endif
51 |
52 | ;; ================================================================================
53 | ;; Bass
54 | ;; ================================================================================
55 |
56 | schedule "bass", .0, .1, 70 * (rnd(1) < .8 ? 1 : int(random(2,5)))
57 |
58 | ;; ================================================================================
59 | ;; Strings
60 | ;; ================================================================================
61 |
62 | if ibeat % 4 == 0 then
63 | schedule "strings", .0, 4.0, cpsmidinn(61)
64 | schedule "strings", .0, 4.0, cpsmidinn(68)
65 | iNotes[] fillarray 80, 81, 83
66 | schedule "strings", .0, 4.0, cpsmidinn(iNotes[int(ibeat / 16) % lenarray(iNotes)])
67 | endif
68 |
69 |
70 | ;; ================================================================================
71 | ;; Synth
72 | ;; ================================================================================
73 |
74 | if ibeat % .5 == 0 then
75 | schedule "synth", .0, .5, 70
76 | endif
77 |
78 | if ibeat % 8 == 0 then
79 | schedule "synth", .0, .5, 190
80 | schedule "synth", .0, .5, 250
81 | schedule "synth", .0, .5, 670
82 |
83 | schedule "synth", ibeatDur * 1.75, .5, 190
84 | schedule "synth", ibeatDur * 1.75, .5, 250
85 | schedule "synth", ibeatDur * 1.75, .5, 400
86 | endif
87 |
88 |
89 | ;; ================================================================================
90 | ;; Recursive call to schedule
91 | ;; ================================================================================
92 |
93 | schedule "schedule", ibeatDur*.25, 0.1, ibeat+.25
94 |
95 | endin
96 |
97 |
98 |
99 | instr synth
100 | kenv linseg .13, p3* .9, .13, p3*.1, .0
101 | a1 vco2 kenv, p4
102 | a2 vco2 kenv, p4 * pow(2, 7/12)
103 | asig = (a1 + a2) * .6
104 | icutoff = 200
105 | asig moogladder2 asig, linseg:k(3400, p3*.2,icutoff, p3*.1, icutoff), 0.1
106 | outs asig, asig
107 |
108 | gaRevL += asig * .5
109 | gaRevR += asig * .5
110 | endin
111 |
112 |
113 |
114 | instr strings
115 | aenv linseg .0, p3*.2, .1, p3*.6, .1, p3*.2, .0
116 | aenv *= .2
117 | al oscil aenv, p4, giWave1
118 | ar oscil aenv, p4+.1, giWave1
119 | icutoff = 1600
120 | outs moogladder(al, icutoff, 0.2), moogladder(ar, icutoff, 0.2)
121 |
122 | gaRevL += al*.4
123 | gaRevR += ar*.4
124 | gaDelL += al*.3
125 | gaDelR += ar*.3
126 | endin
127 |
128 |
129 |
130 | instr bass
131 | kenv linseg .1, p3*.9, .1, p3*.1, .0
132 | asig vco2 kenv*.4, p4, 2, 0.5
133 | outs asig, asig
134 | gaDelL += asig*.2
135 | gaDelR += asig*.2
136 |
137 | endin
138 |
139 |
140 |
141 | instr sample_player
142 | iamp = p5
143 | aindx line .0, p3, ftsr(p4) * p3
144 | asig table aindx, p4
145 | asig *= linseg:a( iamp, p3*.9, iamp, p3*.1, .0 )
146 | outs asig, asig
147 |
148 | endin
149 |
150 |
151 | instr reverb
152 | al, ar reverbsc gaRevL, gaRevR, .9, 12000
153 | outs al, ar
154 |
155 | clear gaRevL, gaRevR
156 | endin
157 |
158 |
159 | instr delay
160 | al vdelay gaDelL, 60/gkBPM * (1000/2), 4000
161 | ar vdelay gaDelR, 60/gkBPM * (1000/3), 4000
162 | outs al, ar
163 | gaDelL = al * .3
164 | gaDelR = ar * .3
165 | endin
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/240826.lisp:
--------------------------------------------------------------------------------
1 | (ql:quickload '(:cl-collider :sc-extensions :arrow-macros))
2 |
3 | (in-package :sc-user)
4 | (named-readtables:in-readtable :sc)
5 | (use-package '(:sc-extensions :arrow-macros))
6 |
7 | (setf *s* (make-external-server "localhost" :port 57140))
8 | (server-boot *s*)
9 |
10 | (bpm 96.0)
11 |
12 | (defvar *reverb* (bus-audio :chanls 2))
13 | (defvar *delay* (bus-audio :chanls 2))
14 |
15 | (proxy :reverb
16 | (g-verb.ar (in.ar *reverb* 2) 100 6.0))
17 |
18 | (proxy :delay
19 | (comb-n.ar (in.ar *delay* 2) 2.0 [1/3 1/2] 4.0))
20 |
21 |
22 | (proxy :fm-solar
23 | (let* ((freq (loop for i below 4 collect (exp-rand.ir 50 3000)))
24 | (trig (dup (lambda (i) (rand-tr (tr 4) .2)) (length freq)))
25 | (ratio (loop for tr in trig
26 | collect (t-line.kr (ti-rand.kr 1 4 tr) (t+ tr [.1 .2 .5 .7 1.0])
27 | (t-exp-rand.kr .01 .1 tr) tr :exp)))
28 | (indx (t-exp-rand.kr 1 4 trig))
29 | (mod (sin-osc.ar (* 1000 (ti-rand.kr 1 8 (tr .25))) 0 (t-exp-rand.kr .0 2.0 trig)))
30 | (sig nil))
31 | (setf sig
32 | (-> (pm-osc.ar freq (* freq ratio) indx mod .1)
33 | (* (env.kr .0 (div (t+ (mix trig) [1 2 4 8])) .3 trig 1))
34 | (pan2.ar (coin.kr trig .7 .0 (t-rand.kr -.8 .8 trig)))
35 | (mix)))
36 | (out.ar (coin.kr (mix trig) .7 *reverb* *delay*) (* sig (trig.kr (rand-tr (mix trig) .2)) .1))
37 | sig))
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/240901.scd:
--------------------------------------------------------------------------------
1 | //
2 | // 2024.09.01 byulparan@gmail.com
3 | //
4 | //
5 |
6 | // Need Quarks Library
7 | Quarks.install("wslib");
8 |
9 |
10 |
11 | (
12 | // ================================================================================
13 | //
14 | // Setup
15 | //
16 | // ================================================================================
17 |
18 | TempoClock.tempo_(110/60);
19 |
20 |
21 | // ================================================================================
22 | // Synth Definition
23 | // ================================================================================
24 |
25 | SynthDef(\vst_synth, {
26 | Out.ar(0, VSTPlugin.ar(nil, 2)*0.8);
27 | }).add;
28 |
29 |
30 | // ================================================================================
31 | // Aalto Setup
32 | // ================================================================================
33 |
34 | ~releaseControl = Bus.control; // evn2_release
35 | ~reverbControl = Bus.control; // reverb
36 |
37 | fork {
38 | ~aalto = VSTPluginController(Synth(\vst_synth)).open("Aalto.vst");
39 | 4.0.wait;
40 | ~aalto.editor;
41 | ~aalto.map(123, ~reverbControl);
42 | ~aalto.map(74, ~releaseControl);
43 | ~aalto.readProgram(Document.current.dir ++ "/samples/240901-aalto.fxp");
44 | };
45 |
46 |
47 | Ndef(\aaltoControl, {
48 | Out.kr(~reverbControl, \reverb.kr(0.0));
49 | Out.kr(~releaseControl, \release.kr(0.0));
50 | });
51 |
52 |
53 | // ================================================================================
54 | // FM Noise
55 | // ================================================================================
56 |
57 | Ndef(\fmOsc, {
58 | var trig = \trig.tr(0);
59 | var dur = \dur.kr(0.2);
60 | var fr = \freq.kr(110);
61 | var freq = Env([fr, fr, 40], [0.0, \freqDec.kr(0.08)], \exp).kr(0, trig);
62 | var env = Env([0.2, 0.2, 0.0], dur*[0.0, 1.0]).kr(0, trig);
63 | var modOsc = SinOsc.ar(\modFreq.kr(500), 0, \modIndx.kr(0.2));
64 | var sig = Pan2.ar(Mix(PMOsc.ar(freq, freq*\ratio.kr(1), 4.0, modOsc, env)), \pan.kr(0.0));
65 | Fold.ar(sig * LFNoise1.kr(1.3).range(1, 10), -0.3, 0.3) * 0.2;
66 | })
67 |
68 |
69 | )
70 |
71 |
72 |
73 |
74 |
75 | (
76 | // ================================================================================
77 | //
78 | // Performances
79 | //
80 | // ================================================================================
81 |
82 |
83 | // ================================================================================
84 | // Sequencer Data
85 | // ================================================================================
86 |
87 | var scStep = Array.fill(64, {|i| if(i % 4 == 0, {1}, {0}) });
88 | var aaltoStep = Array.fill(64, {|i| if(i % 4 == 0, {1}, {0}) });
89 | var curSelect = 0;
90 | var aaltoSeq, aaltoControlSeq, fmOscSeq, allStreamPlayer;
91 |
92 |
93 | // ================================================================================
94 | // GUI
95 | // ================================================================================
96 |
97 | var win = Window("Aalto in SuperCollider", Rect(0, 90, 900, 250)).front;
98 |
99 | // Play/Stop Button ================================================================================
100 | var transport = Button(win, Rect(10, 15, 100, 20))
101 | .states_([["PLAY"], ["STOP"]])
102 | .action_({
103 | if(transport.value == 1, {
104 | Ndef(\aaltoControl).play;
105 | Ndef(\fmOsc).play;
106 | allStreamPlayer = [aaltoSeq, aaltoControlSeq, fmOscSeq].collect({|seq| seq.play})
107 | }, {
108 | allStreamPlayer.do{|player|
109 | player.stop;
110 | }
111 | })
112 | });
113 |
114 | // Led ================================================================================
115 | var leds = {|i|
116 | Button(win, Rect(i * 40 + 135, 15, 20, 20))
117 | .states_([["", Color.black, if(i % 4 == 0, {Color.black} ,{ Color.gray}) ], ["", Color.red, Color.red]]);
118 | } ! 16;
119 |
120 | // StepNote ================================================================================
121 | var scStepValue = {|i|
122 | RoundButton(win, Rect(i * 40 + 135, 50, 20, 20))
123 | .states_([["", Color.black], ["", Color.new255(147, 112, 219), Color.new255(147, 112, 219)]])
124 | .action_({ scStep[16*curSelect + i] = scStepValue[i].value })
125 | .value_(scStep[i])
126 | } ! 16;
127 |
128 | var aaltoStepValue = {|i|
129 | RoundButton(win, Rect(i * 40 + 135, 80, 20, 20))
130 | .states_([["", Color.black], ["", Color.new255(130, 130, 255), Color.new255(130, 130, 255)]])
131 | .action_({ aaltoStep[16*curSelect + i] = aaltoStepValue[i].value })
132 | .value_(aaltoStep[i])
133 | } ! 16;
134 |
135 |
136 | // Label ================================================================================
137 | var scLabel = StaticText(win, Rect(765, 45, 80, 30)).align_(\center).background_(Color.new255(147, 112, 219)).string_("SC_FM_Pat");
138 | var aaltoLabel = StaticText(win, Rect(765, 75, 80, 30)).align_(\center).background_(Color.new255(130, 130, 255)).string_("Aalto_Pat");
139 |
140 |
141 | // Sequencer Selector ================================================================================
142 | var patternSelector = ListView(win, Rect(10, 40, 100, 80))
143 | .items_(["1", "2", "3", "4"])
144 | .action_({
145 | curSelect = patternSelector.selection[0];
146 | scStepValue.do{|but, idx|
147 | { but.value = scStep[16 * curSelect + idx] }.defer;
148 | };
149 | aaltoStepValue.do{|but, idx|
150 | { but.value = aaltoStep[16 * curSelect + idx] }.defer;
151 | };
152 | });
153 |
154 |
155 | // ================================================================================
156 | // for Monitor(scope, meter etc)
157 | // ================================================================================
158 |
159 | var meterL = LevelIndicator(win, Rect(60,140,20,100)).drawsPeak_(true).warning_(0.9).critical_(1.0);
160 | var meterR = LevelIndicator(win, Rect(90,140,20,100)).drawsPeak_(true).warning_(0.9).critical_(1.0);
161 |
162 | var oscHandle = OSCFunc({|level|
163 | {
164 | var dbLow = -80;
165 | meterL.value = level[4].ampdb.linlin(dbLow, 0, 0, 1);
166 | meterL.peakLevel = level[3].ampdb.linlin(dbLow, 0, 0, 1);
167 | meterR.value = level[6].ampdb.linlin(dbLow, 0, 0, 1);
168 | meterR.peakLevel = level[5].ampdb.linlin(dbLow, 0, 0, 1);
169 | }.defer;
170 | }, "/level");
171 |
172 | var freqscope = FreqScopeView(win, Rect(135, 140, 200, 100)).freqMode_(0).active_(true);
173 | var buffer = Buffer.alloc(s, 256, 2, bufnum: 10);
174 | var scope = ScopeView(win, Rect(350, 140, 200, 100));
175 |
176 | var monitorSynth = {
177 | ScopeOut2.ar(In.ar(0,2)*2, buffer.bufnum, 4096, buffer.numFrames);
178 | SendPeakRMS.kr(In.ar(0, 2), cmdName: "/level");
179 | }.play(target: 1, addAction: \addAfter);
180 |
181 |
182 | freqscope.waveColors_([Color.green]);
183 | scope.bufnum = buffer.bufnum;
184 | scope.server = s;
185 | scope.waveColors_([Color.yellow, Color.yellow]);
186 | scope.start;
187 |
188 |
189 | // ================================================================================
190 | // Sequence
191 | // ================================================================================
192 |
193 | aaltoSeq = Pbind(
194 | \type, \vst_midi,
195 | \vst, ~aalto,
196 | \amp, 0.5,
197 | \dur, p{
198 | inf.do{|i|
199 | 16.do{|j|
200 | {leds[j].value = if(i % 16 == j, {1}, {0})}.defer(s.latency);
201 | };
202 | if(aaltoStep[16 * curSelect + (i % 16)] == 1, { 0.25.yield }, { Rest(0.25).yield });
203 | };
204 | }
205 | );
206 |
207 | aaltoControlSeq = Pbind(
208 | \type, \set,
209 | \id, Ndef(\aaltoControl).nodeID,
210 | \args, #[release, reverb],
211 | \release, Pif(0.5.loop.coin, 0.04, Pwhite(0.6, 0.8)),
212 | \reverb, Pif(0.8.loop.coin, 0.0, Pwhite(0.4, 0.6)),
213 | \dur, 0.25
214 | );
215 |
216 |
217 | fmOscSeq = Pbind(
218 | \type, \set,
219 | \id, Ndef(\fmOsc).nodeID,
220 | \args, #[trig, freq, freqDec, ratio, modFreq, modIndx, pan],
221 | \trig, 1,
222 | \freq, 110 * Pif(0.7.loop.coin, 1, Pwhite(2,4)),
223 | \freqDec, 0.08 * Pif(0.7.loop.coin, 1, Pwhite(2, 4)),
224 | \ratio, Pif(0.5.loop.coin, 1, 4),
225 | \modFreq, 500 * Pwhite(1, 10),
226 | \modIndx, 0.2 * Pwhite(0,2),
227 | \pan, Pif(0.7.loop.coin, 0.0, Pwhite(-1.0, 1.0)),
228 | \dur, 0.125 * pow(2, Pwhite(0, 4)),
229 | \delta, p{
230 | inf.do{|i|
231 | if(scStep[16 * curSelect + (i % 16)] == 1, { 0.25.yield }, { Rest(0.25).yield });
232 | };
233 | }
234 | );
235 |
236 |
237 | // ================================================================================
238 | // handle for close the GUI
239 | // ================================================================================
240 |
241 | CmdPeriod.doOnce({win.close});
242 |
243 | win.onClose_({
244 | freqscope.kill;
245 | buffer.free;
246 | monitorSynth.free;
247 | allStreamPlayer.do{|player|
248 | player.stop;
249 | }
250 | });
251 |
252 |
253 | )
254 |
255 |
256 |
--------------------------------------------------------------------------------
/240906.csd:
--------------------------------------------------------------------------------
1 |
2 |
3 | -odac -m4 --port=10000
4 |
5 |
6 |
7 | sr = 44100
8 | ksmps = 32
9 | nchnls = 2
10 | 0dbfs = 1.0
11 | seed 0
12 |
13 |
14 |
15 | ;; ================================================================================
16 | ;; Global Setup
17 | ;; ================================================================================
18 |
19 | gkBPM init 120
20 |
21 | ;; Audio Bus for Reverb/Delay
22 | gaRevL init 0
23 | gaRevR init 0
24 | gaDelL init 0
25 | gaDelR init 0
26 |
27 |
28 | ;; Wavetable / Global Variables
29 | giWave1 ftgen 1, 0, 8192, 10, 1, 0.7, 0.5, 0.2, 0.3, 0.2, 0.4
30 |
31 | giMelodyCount init 0
32 | giBeats[] fillarray 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 10.5, 12.0
33 | giMelody init 0
34 | giMelodies[] fillarray 12, 11, 7, 4, 7, 0, 2, 4, 0, 2, 4
35 |
36 | giStringMelodyCount init 0
37 | giStringBeats[] fillarray 0, 1, 2, 3, 10, 11, 12, 13, 14, 15, 16, 32, 36, 44, 45, 46, 47, 48, 52
38 | giStringMelodies[] fillarray 7, 5, 4, 12, 11, 12, 14, 12, 11, 12, 16, 17, 5, 4, 5, 4, 5, 4, -3
39 |
40 |
41 |
42 | ;; Startup Instrument
43 | schedule "reverb", 0, -1
44 | schedule "delay", 0, -1
45 | schedule "schedule", 0, 0.1, 0
46 |
47 |
48 | ;; ================================================================================
49 | ;; Scheduler
50 | ;; ================================================================================
51 |
52 | instr schedule
53 |
54 | ibeat = p4
55 | ibeatDur = 60/i(gkBPM)
56 |
57 | ;; ================================================================================
58 | ;; main theme
59 | ;; ================================================================================
60 |
61 | if ibeat % 16 == giBeats[giMelodyCount % lenarray(giBeats)] then
62 | giMelody = giMelodies[giMelodyCount % lenarray(giBeats)]
63 | giMelodyCount += 1
64 | endif
65 |
66 | ipan = rnd(1) < 0.5 ? 0.5 : rnd(1)
67 |
68 | schedule "melody_synth", 0, 0.06, cpsmidinn(giMelody + 70), ipan
69 | schedule "melody_synth", 0, 0.06, cpsmidinn(58 + 7), ipan
70 | schedule "melody_synth", 0, 0.06, cpsmidinn(58 + (int(ibeat / 8) % 2 == 0 ? 5 : 4)), ipan
71 | schedule "melody_synth", 0, 0.06, cpsmidinn(58), ipan
72 |
73 |
74 | ;; ================================================================================
75 | ;; string melody
76 | ;; ================================================================================
77 |
78 | ;; if ibeat % 64 == giStringBeats[giStringMelodyCount] then
79 | ;; istringDur = (giStringMelodyCount == (lenarray(giStringBeats) - 1) ? 60 : giStringBeats[giStringMelodyCount + 1]) - giStringBeats[giStringMelodyCount]
80 | ;; schedule "strings", 0, istringDur*ibeatDur, cpsmidinn(giStringMelodies[giStringMelodyCount] + 70)
81 | ;; giStringMelodyCount = (giStringMelodyCount + 1) % lenarray(giStringBeats)
82 | ;; endif
83 |
84 |
85 |
86 | if ibeat % 8.0 == 0 then
87 | ;; ================================================================================
88 | ;; bass
89 | ;; ================================================================================
90 |
91 | ibassNote[] fillarray 0, -3, -7, -3
92 | ibass = ibassNote[ int(ibeat / 16) % lenarray(ibassNote) ]
93 | schedule "bass", 0, 1.5, cpsmidinn(ibass + 46)
94 | schedule "bass", ibeatDur*3.0, 0.25, cpsmidinn(ibass + 46)
95 | schedule "bass", ibeatDur*4.0, 2, cpsmidinn(ibass + 46)
96 |
97 | ;; ================================================================================
98 | ;; fm-piano
99 | ;; ================================================================================
100 |
101 | ;; schedule "fm_piano", 0, 2, cpsmidinn(ibass+58)
102 | ;; schedule "fm_piano", 0, 2, cpsmidinn(58 + 7)
103 | ;; inotes[] fillarray 11, 14, 17, 19
104 | ;; inoteIndx = int(random(0, lenarray(inotes)))
105 | ;; idel = int(random(1,4))
106 | ;; schedule "fm_piano", ibeatDur * idel , 2, cpsmidinn(58 + inotes[inoteIndx])
107 | ;; inoteIndx = (inoteIndx + int(random(1, lenarray(inotes)-1))) % lenarray(inotes)
108 | ;; idel += int(random(0,4))
109 | ;; schedule "fm_piano", ibeatDur * idel, 2, cpsmidinn(58 + inotes[inoteIndx])
110 | ;; inoteIndx = (inoteIndx + int(random(1, lenarray(inotes)-1))) % lenarray(inotes)
111 | ;; idel += int(random(0,4))
112 | ;; schedule "fm_piano", ibeatDur * idel, 2, cpsmidinn(58 + inotes[inoteIndx])
113 |
114 | endif
115 |
116 |
117 | ;; ================================================================================
118 | ;; pad
119 | ;; ================================================================================
120 |
121 | if ibeat % 8 == 0 then
122 | schedule "pad", .0, 8, cpsmidinn(58)
123 | inotes[] fillarray 4, 5, 7, 11
124 | schedule "pad", .0, 8, cpsmidinn(inotes[int(random(0, lenarray(inotes)))] + 58)
125 | inotes[] fillarray 5, 7, 11, 16, 17, 19
126 | schedule "pad", .0, 8, cpsmidinn(inotes[int(random(0, lenarray(inotes)))] + 70)
127 | endif
128 |
129 | ;; ================================================================================
130 | ;; kick
131 | ;; ================================================================================
132 |
133 | if ibeat % 4 == 0 then
134 | schedule "kick", 0, 0.1
135 | endif
136 |
137 | ;; ================================================================================
138 | ;; sine noise
139 | ;; ================================================================================
140 |
141 | if ibeat % 16 == 0 then
142 | schedule "sine", ibeatDur*.75, 0.2, 9000
143 | endif
144 |
145 | ;; ================================================================================
146 | ;; recursive call schedule
147 | ;; ================================================================================
148 |
149 | schedule "schedule", ibeatDur*.25, 0.1, ibeat+.25
150 |
151 | endin
152 |
153 |
154 |
155 | ;; ================================================================================
156 | ;; Instruments
157 | ;; ================================================================================
158 |
159 | instr melody_synth
160 | aenv linseg .1, p3*.9, .1, p3*.1, .0
161 | ifreq = p4
162 | asig foscil aenv*0.8, ifreq, 1, 1, linseg:k(1, p3*.9,1, p3*.1, 0.2) * 1.3
163 | al, ar pan2 asig, p5
164 | outs al, ar
165 |
166 | gaRevL += al *.3
167 | gaRevR += ar *.3
168 | gaDelL += al *.3
169 | gaDelR += ar *.3
170 | endin
171 |
172 |
173 |
174 |
175 | instr kick
176 | kfreq expon 280, p3, 20
177 | asig oscil line:a(0.3, p3, 0), kfreq
178 | outs asig, asig
179 | endin
180 |
181 |
182 |
183 | instr sine
184 | aenv linseg .1, p3*.9,.1, p3*.1, 0
185 | asig oscil aenv*.4, p4
186 | outs asig, asig
187 | gaRevL += asig*.1
188 | gaRevR += asig*.1
189 | endin
190 |
191 |
192 |
193 | instr fm_piano
194 | kenv linseg .07, p3, .0
195 | kindx line 1, p3, 0
196 | al foscil kenv, p4, 1, 1, 1
197 | ar foscil kenv, p4+2, 1, 1, 1
198 | outs al, ar
199 | gaRevL += al*.2
200 | gaRevR += ar*.2
201 | gaDelL += al*.2
202 | gaDelR += ar*.2
203 | endin
204 |
205 |
206 |
207 | instr bass
208 | kfreq linseg p4+100, p3*.04, p4, p3*.8, p4
209 | asig foscil line:k(0.1, p3, 0)*1.2, kfreq, 1, 0.5, oscil:k(0.5, 1.3)+0.7
210 | outs asig, asig
211 | endin
212 |
213 |
214 |
215 | instr pad
216 | kenv linseg .0, p3*.2, 1, p3*.6, 1, p3*.2, .0
217 | al = reson(noise(0.007*kenv,0.0), p4, 0.8) * 0.007
218 | ar = reson(noise(0.007*kenv,0.0), p4+2, 0.8) * 0.007
219 | outs al,ar
220 | gaRevL += al*.3
221 | gaRevR += ar*.3
222 | endin
223 |
224 |
225 |
226 | instr strings
227 | aenv linseg .0, p3*.05, .1, p3*.75, .1, p3*.2, .0
228 | aenv *= .4
229 | al oscil aenv, p4, giWave1
230 | ar oscil aenv, p4+.1, giWave1
231 | icutoff = 2600
232 | outs moogladder(al, icutoff, 0.2), moogladder(ar, icutoff, 0.2)
233 |
234 | gaRevL += al*.4
235 | gaRevR += ar*.4
236 | gaDelL += al*.3
237 | gaDelR += ar*.3
238 | endin
239 |
240 |
241 |
242 | ;; ================================================================================
243 | ;; Effect
244 | ;; ================================================================================
245 |
246 | instr reverb
247 | al, ar reverbsc gaRevL, gaRevR, .9, 12000
248 | outs al, ar
249 | clear gaRevL, gaRevR
250 | endin
251 |
252 |
253 | instr delay
254 | al vdelay gaDelL, 60/gkBPM * (1000/2), 4000
255 | ar vdelay gaDelR, 60/gkBPM * (1000/3), 4000
256 | outs al, ar
257 | gaDelL = al * .3
258 | gaDelR = ar * .3
259 | endin
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
--------------------------------------------------------------------------------
/241228.scd:
--------------------------------------------------------------------------------
1 |
2 | // ================================================================================
3 | // Ensure Server Boot
4 | s.boot;
5 |
6 |
7 |
8 |
9 | (
10 | // ================================================================================
11 | // Everything In Its Right Place - Radiohead
12 | // Cover in SuperCollider
13 | //
14 |
15 | // ================================================================================
16 | // Setup
17 | // ================================================================================
18 |
19 |
20 | TempoClock.tempo_(123/60);
21 |
22 | SynthDef(\kick, {
23 | var freq = XLine.kr(220, 20, 0.1);
24 | var sig = SinOsc.ar(freq, 0, Line.kr(0.3, 0, 0.2, doneAction: Done.freeSelf));
25 | Out.ar(0, Pan2.ar(sig));
26 | }).add;
27 |
28 | SynthDef(\keyboard, {|freq = 440, dur = 1.0, amp= 0.1|
29 | var env = EnvGen.kr(Env([0,1,1,0], dur*[0, 0.8, 0.2]), doneAction: Done.freeSelf);
30 | var mod = SinOsc.ar(freq, 0, 1.6);
31 | var sig = SinOsc.ar(freq + [0, 1], mod, env*amp);
32 | Out.ar(0, sig);
33 | }).add;
34 |
35 |
36 |
37 | b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
38 | ~bus = Bus.audio(s, 2);
39 |
40 | {
41 | CombN.ar(In.ar(~bus, 2), 2.0, TempoClock.tempo.reciprocal * [0.25, 1/3], 3.0);
42 | }.play(target: 0, addAction: \addToTail);
43 |
44 |
45 | Ndef(\voice)[0] = {
46 | var local = LocalBuf(256);
47 | var trig = \trig.tr(0);
48 | var startPos = (BufFrames.kr(b) / 16) * \pos.kr(0);
49 | var src = PlayBuf.ar(1, b, \rate.kr(1), startPos: startPos, trigger: trig);
50 | var env = Env([0,1,1,0], \dur.kr(1) * (TempoClock.tempo.reciprocal) * [0.0,0.8,0.2]).kr(0, trig);
51 | var chain = FFT(local, src * env);
52 | var sig;
53 | chain = PV_Freeze(chain, \freeze.kr(0));
54 | sig = Pan2.ar(IFFT(chain) * Env.asr(4,0.8,4).kr(0, \fade.kr(0)), \pan.kr(0.0));
55 | Out.ar(~bus, sig*\del.kr(0));
56 | sig;
57 | };
58 |
59 | Ndef(\voice).set(\fade, 0);
60 |
61 | Ndef(\voice)[1] = \set->Pbind(
62 | \freeze, Pif(0.75.loop.coin, 0, 1),
63 | \pos, Pstep(Pif(0.85.loop.coin, Ptime() * 1.3 % 12, Pwhite(3, 8)), 0.5),
64 | \rate, Pstep(Prand([0.75, 1.0],inf), 0.5),
65 | \pan, Pif(0.7.loop.coin, 0.0, Pwhite(-1.0, 1.0)),
66 | \del, Pif(0.9.loop.coin, 0, 0.3),
67 | \dur, Pstep(Prand([0.5, 0.5, 0.25, 0.125], inf), 0.5)
68 | );
69 |
70 |
71 | // ================================================================================
72 | // Performance
73 | // ================================================================================
74 |
75 |
76 | Routine{
77 |
78 | // ================================================================================
79 | // define function for play score
80 | var playScore = {|notes, beatsArray|
81 | beatsArray.do{|beats, indx|
82 | beats.do{|beat|
83 | notes[indx].do{|note|
84 | s.bind({ Synth(\keyboard, [\freq, note.midicps, \dur, beat*0.6]) });
85 | };
86 | beat.wait;
87 | }
88 | };
89 | };
90 |
91 | var playArp = {|notes|
92 | notes.do{|note|
93 | if(note.notNil, {
94 | s.bind({ Synth(\keyboard, [\freq, note.midicps, \dur, 0.5]) });
95 | });
96 | 0.5.wait;
97 | }
98 | };
99 |
100 |
101 | // ================================================================================
102 | // play Music
103 | playArp.([60,56,55,48]);
104 |
105 |
106 | // ================================================================================
107 | // play kick and voice
108 | fork{
109 | Ndef(\voice).set(\fade, 0);
110 | 20.wait;
111 | Ndef(\voice).play;
112 | Ndef(\voice).set(\fade, 1);
113 |
114 | inf.do{
115 | s.bind({ Synth(\kick) });
116 | 1.0.wait;
117 | }
118 | };
119 |
120 |
121 | // ================================================================================
122 | // Part.1
123 | 7.do{|i|
124 | var notes = [[36, 48, 52, 55, 60],[37, 49, 53, 55, 60], [39, 51, 55, 60]];
125 | var beats = [[1.5, 1, 1], [1, 1], [1, 1.5]];
126 |
127 | playScore.(notes, beats);
128 | playArp.(if(i % 2 == 0, { [60,58,60,48] }, { [60,56,55,48] }));
129 | };
130 |
131 | inf.do{
132 | // ================================================================================
133 | // Part.2
134 | 4.do{|i|
135 | var notes = [[41, 53, 57, 60], [36, 48, 52, 55, 60], [37, 49, 53, 55, 60], [39, 51, 55, 60]];
136 | var beats = [[1.5], [1, 1], [1, 1], [1, 1.5]];
137 |
138 | playScore.(notes, beats);
139 | playArp.(if(i != 3, { [60,58,60,48] }, { [60,56,55,48] }));
140 | };
141 |
142 | // ================================================================================
143 | // Part.1
144 | 4.do{|i|
145 | var notes = [[36, 48, 52, 55, 60],[37, 49, 53, 55, 60], [39, 51, 55, 60]];
146 | var beats = [[1.5, 1, 1], [1, 1], [1, 1.5]];
147 |
148 | playScore.(notes, beats);
149 | playArp.(if(i != 3, { [60,56,55,48] }, { [60,58,60,nil] } ));
150 | };
151 |
152 | // ================================================================================
153 | // Part.3
154 | 1.do{
155 | var notes = [[37, 49, 53, 56, 60], [36, 48, 52, 55, 60], [39, 51, 55, 58, 60], [39, 51, 55, 58, 61]];
156 |
157 | playScore.(notes, [[2, 1.5, 1], [1, 1], [1], [1]]);
158 |
159 | 2.do{
160 | playScore.(notes, [[1.5, 2, 1.5, 1], [1, 1], [1], [1]]);
161 | };
162 |
163 | playScore.(notes, [[1.5, 2, 1.5, 1], [1, 1], [1, 1.5]]);
164 | };
165 | }
166 |
167 | }.play;
168 | )
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LiveCoding Collection of SungminPark
2 |
3 | LiveCoding Performance.
4 |
5 | 230204.csd - https://youtu.be/eacyGKRBpwA
6 | 230318.csd - https://youtu.be/MFW7z-1T4WE
7 | 240531.lisp - https://youtu.be/jS84KmkkNkU
8 | 240610.scd - https://youtu.be/XGTz-asZEMg
9 | 240630 - https://youtu.be/sC5Vtx73tnE
10 | 240806.scd - https://youtu.be/2UqN5v2sxMc
11 | 240824.csd - https://youtu.be/1XsALiXZnEg
12 | 240826.lisp - https://youtu.be/lCVVTnCaE7A
13 | 240901.scd - https://youtu.be/73aSOBQk7a8
14 | 240906.csd - https://youtu.be/DnEIjh9wcXI
15 | 241228.scd - https://youtu.be/BatWg0-NMYs
16 |
--------------------------------------------------------------------------------
/samples/240901-aalto.fxp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/240901-aalto.fxp
--------------------------------------------------------------------------------
/samples/hihat.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/hihat.wav
--------------------------------------------------------------------------------
/samples/hihat1.aif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/hihat1.aif
--------------------------------------------------------------------------------
/samples/kick.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/kick.wav
--------------------------------------------------------------------------------
/samples/kick1.aif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/kick1.aif
--------------------------------------------------------------------------------
/samples/rain1.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/rain1.ogg
--------------------------------------------------------------------------------
/samples/snare.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/snare.wav
--------------------------------------------------------------------------------
/samples/snare2.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byulparan/livecoding/e4ee375404487459163d0d364df15a58cb54ad4a/samples/snare2.wav
--------------------------------------------------------------------------------