«Sound Simulator's "Ryoji Ikeda Pure Data Tutorial" ported to SC» by gosub

on 30 May'24 09:09 in ikedaryojiikedamicrosoundpuredata

Sound Simulator's "Ryoji Ikeda Pure Data Tutorial" ported to SC

source: https://www.youtube.com/watch?v=CLddxGIlVPU

I only did the porting, kudos to Sound Simulator for the original idea and Pure Data implementation!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Sound Simulator's "Ryoji Ikeda Pure Data Tutorial" ported to SC
// source: https://www.youtube.com/watch?v=CLddxGIlVPU
// I only did the porting, kudos to Sound Simulator for the original idea
// and Pure Data implementation!

(
// SynthDefs & helper functions

~coeff = {|freq| exp(-2pi * (freq * SampleDur.ir))};

SynthDef(\click, { |out, amp=0.1|
	var snd;
	snd = Impulse.ar(0);
	snd = OnePole.ar(snd, ~coeff.(Rand(500, 10000)));
	DetectSilence.ar(snd, doneAction: Done.freeSelf);
	snd = snd * amp;
	snd = Pan2.ar(snd, pos: Rand(-1, 1));
	Out.ar(out, snd);
}).add;

SynthDef(\highshort, { |out, amp=0.1|
	var snd;
	snd = SinOsc.ar(10000);
	snd = snd * EnvGen.ar(Env([0,1,1,0], [0.001, 0.010, 0.010]), doneAction: Done.freeSelf);
	snd = snd * amp;
	Out.ar(0, snd!2);
}).add;

SynthDef(\bass, { |out, amp=0.1|
	//TODO: substitute HPF with OnePole+OneZero, but we must calculate the coeffs!
	var snd, noi;
	snd = SinOsc.ar([49, 98, 196]).sum * 2.0;
	snd = Clip.ar(snd, -0.9, 0.9);
	snd = OnePole.ar(snd, ~coeff.(50));
	snd = HPF.ar(snd, 20);
	noi = HPF.ar(OnePole.ar(WhiteNoise.ar, ~coeff.(100)), 500); // HPF = [hip~ 500]*2
	noi = noi * EnvGen.ar(Env.linen(0.010, 0.005, 0.005));
	snd = snd * EnvGen.ar(Env.linen(0.010, 1.090, 0.200), doneAction: Done.freeSelf);
	snd = snd + noi;
	snd = snd * amp;
	Out.ar(out, snd!2);
}).add;

SynthDef(\envsine, { |out, amp=0.1|
	var snd, noi;
	snd = SinOsc.ar(1174);
	snd = snd * EnvGen.ar(Env.linen(0.010, 0.200, 0.500));
	snd = snd;
	snd = FreeVerb2.ar(snd, snd, mix: 0.5, room: 0.7, damp: 0.2);
	snd = snd * amp;
	DetectSilence.ar(snd, doneAction: Done.freeSelf);
	Out.ar(out, snd);
}).add;

SynthDef(\highlong, { |out, amp=0.1|
	var snd;
	snd = SinOsc.ar(12544);
	snd = snd * EnvGen.ar(Env.linen(0.001, 0.400, 0.150), doneAction: Done.freeSelf);
	snd = snd * amp;
	Out.ar(out, snd!2);
}).add;

SynthDef(\midsine, { |out, amp=0.1|
	var snd, env;
	snd = SinOsc.ar(3136);
	snd = Clip.ar(snd, -0.9, 0.9);
	env=Env.linen(0.005, 0.050, 0.010);
	snd = snd * EnvGen.ar(env, doneAction: Done.freeSelf);
	snd = snd * amp;
	Out.ar(out, snd!2);
}).add;

SynthDef(\burst, { |out, amp=0.1|
	var snd;
	snd = WhiteNoise.ar(mul: -7.dbamp);
	snd = snd * EnvGen.ar(Env.linen(0.001, 0.400, 0.010), doneAction: Done.freeSelf);
	snd = snd * amp;
	Out.ar(out, snd!2);
}).add;

~xox = {|str| str.collectAs({|l| switch(l.toLower,$x, {1}, $o, {Rest(1)})}, Array)};
)

(
// sequencing

~tick32 = 0.08823;
~tick16 = ~tick32 * 2;

~p1 = "xxxxxxxxxxxxxxxx"; //click
~p2 = "xxxoxxooxxxooxxo"; //highshort
~p3 = "xooooooooooooooooooxoooooooooooo"; //bass
~p4 = "ooooooxooooooooooooooooooooooooo"; //envsine
~p5 = "oooooooooooooooooooooooooxoooooo"; //highlong
~p6 = "xooooooooooooooooooooooooooooooo"
   ++ "xxoooooooooooooooooooooooooooooo"; //midsine

~p7 = Array.newClear(31).fill(Rest(~tick16)).add(~tick16).scramble; //burst

Pdef(\ikeda, Ppar([
	Pbind(\instrument, \click,     \dur, Pseq(~tick32 * ~xox.(~p1), inf)),
	Pbind(\instrument, \highshort, \dur, Pseq(~tick32 * ~xox.(~p2), inf)),
	Pbind(\instrument, \bass,      \dur, Pseq(~tick16 * ~xox.(~p3), inf)),
	Pbind(\instrument, \envsine,   \dur, Pseq(~tick16 * ~xox.(~p4), inf)),
	Pbind(\instrument, \highlong,  \dur, Pseq(~tick16 * ~xox.(~p5), inf)),
	Pbind(\instrument, \midsine,   \dur, Pseq(~tick32 * ~xox.(~p6), inf)),
	Pbind(\instrument, \burst,     \dur, Pseq(~p7, inf)),
])).play;
)

Pdef(\ikeda).stop;


// test single synths
z = Synth(\click);
y = Synth(\highshort);
x = Synth(\bass);
w = Synth(\envsine);
v = Synth(\highlong);
u = Synth(\midsine);
t = Synth(\burst);
raw 3669 chars (focus & ctrl+a+c to copy)
reception
comments