«Breaking Glass» by 38nonprivate

on 26 Aug'11 13:50 in sound effectsbreaking glass

Having a smashing time with SuperCollider. I revised this SynthDef - the newest / best one is at the top and my previous version is below. p.s. I stole Fredrik's technique for timed impulses using Dseq: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Resettable-Impulse-train-td6719797.html

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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// this is the new version!
(
s = Server.default;
s.boot;
)
(
SynthDef(\bglass, {
	
	|t_trig = 1.0, audioOutBus = 0|
	
	var major_hit_times, major_hit_deltas, major_hit_levels, major_hit_impulse_levels, major_hit_impulses;
	var major_hit_amp, major_hit_envGen, major_hit_out;
	var klank_freq_array, klank_out;
	var noise, noise_out;
	var additional_tinkles;
	var initial_impact_pitch_envGen, initial_impact_amp_envGen, initial_impact;
	var comb_out, output;
	
	var last_time;
		
	major_hit_times = [0.02, 0.1, 0.21, 0.28, 0.32, 0.48, 0.6, 0.69];
	major_hit_deltas = [];
	last_time = 0.0;
	major_hit_times.size.do { |i|
		major_hit_deltas = major_hit_deltas ++ 
			[
			SampleDur.ir, 
			((major_hit_times[i] - last_time) * TRand.kr(0.4, 1.6, t_trig)) - SampleDur.ir
			];
		
		last_time = major_hit_times[i];
	};
	major_hit_levels = [1.0, 0.3, 0.7, 0.4, 0.65, 0.87, 0.27, 0.4];
	major_hit_levels.size.do { |i|
		
		major_hit_levels[i] = major_hit_levels[i] * TRand.kr(0.7, 1.0, t_trig);
		
	};
	major_hit_impulse_levels = [major_hit_levels, 0 ! major_hit_times.size].lace(major_hit_times.size * 2);
	major_hit_impulses = Duty.ar(
		Dseq(major_hit_deltas, 1), K2A.ar(t_trig), Dseq(major_hit_impulse_levels, 1)
		);	
	major_hit_amp = Gate.ar(major_hit_impulses, major_hit_impulses);
	major_hit_envGen = EnvGen.ar(Env.perc(0.0, 0.03, 1, -9), major_hit_impulses) * major_hit_amp;
	major_hit_out = major_hit_envGen * WhiteNoise.ar * 0.6;
	major_hit_out = major_hit_out + major_hit_impulses;
	
	klank_freq_array = [1383, 2831, 3252, 3446, 4547, 4600, 4832, 5863, 6813, 8683, 11196];
	klank_freq_array.size.do { |i|
	
		klank_freq_array[i] = klank_freq_array[i] * TRand.kr(0.8, 1.2,  Impulse.kr(20));
	};
	klank_out = DynKlank.ar(`[klank_freq_array, nil, 0.2], major_hit_out * 0.05);
	klank_out = DelayC.ar(klank_out, 0.2, 0.009);

	noise = BrownNoise.ar + (WhiteNoise.ar * 0.3) + (PinkNoise.ar * 0.6);
	noise = noise * 0.1;
	noise = noise + Dust.ar(70, 1);
	noise_out = noise * LagUD.ar(major_hit_impulses, 0.0, 0.842);
	
	additional_tinkles = 
	DynKlank.ar(`[ Array.series(8, 1200, 179), nil, 0.7], Dust.ar(14), TRand.kr(2.9, 3.1, Impulse.kr(28)) )
	+
	DynKlank.ar(`[ Array.series(8, 1200, 179), nil, 0.13], Dust.ar(11, 0.7), TRand.kr(1.4, 2.2, Impulse.kr(15)) );
	
	additional_tinkles = additional_tinkles * 
		EnvGen.ar(Env.linen(0.15, 0.3, 0.3, 1.0, -2), t_trig, timeScale: TRand.kr(0.9, 1.12, t_trig));
	
	initial_impact_pitch_envGen = EnvGen.ar(Env.perc(0.001, 0.03, 1.0, -7), t_trig);
	initial_impact_amp_envGen = EnvGen.ar(Env.perc(0.0, 0.04, 1.0, -9), t_trig);
	initial_impact = SinOsc.ar(initial_impact_pitch_envGen.exprange(20, 4000) * TRand.kr(0.96, 1.03, t_trig)) * 0.5;
	initial_impact = initial_impact + LFNoise1.ar(6800, 1.0) * initial_impact_amp_envGen;
	initial_impact = HPF.ar(initial_impact, 100);
	initial_impact = initial_impact + CombC.ar(initial_impact, 0.2, 0.04, 0.2, 0.12);
	output = (klank_out * 0.5) + (major_hit_out * 0.45);
	output = (output * 0.86) + DelayC.ar(output, 0.2, 0.01);
	output = output + (noise_out * 0.32) + (additional_tinkles * 0.044) + (initial_impact * 0.2);
	
	comb_out = CombC.ar(output, 0.1, [0.028, 0.031], 0.52, 0.23);
	comb_out = LPF.ar(comb_out, 3000);
	comb_out = HPF.ar(comb_out, 110);
	output = output + comb_out;
	Out.ar(audioOutBus, output);
	
}).send(s);

)
x = Synth(\bglass, [\audioOutBus, 0], s);
x.set(\t_trig, 1.0);



///////////////////////////////////////////////////////////////////////////


// and now the previous attempt
(
s = Server.default;
s.boot;
)

(



SynthDef(\bglass, {
	
	|t_trig = 1.0, audioOutBus = 0|
	
	var major_hit_times, major_hit_deltas, major_hit_levels, major_hit_impulse_levels, major_hit_impulses;
	var major_hit_amp, major_hit_envGen, major_hit_out;
	var klank_freq_array, klank_out;
	var noise, noise_out;
	var additional_tinkles;
	var initial_impact_pitch_envGen, initial_impact_amp_envGen, initial_impact;
	var output;
	
	var last_time;
		
	major_hit_times = [0.02, 0.1, 0.21, 0.28, 0.32, 0.48, 0.6, 0.69];
	major_hit_deltas = [];
	last_time = 0.0;
	major_hit_times.size.do { |i|
		major_hit_deltas = major_hit_deltas ++ 
			[
			SampleDur.ir, 
			(major_hit_times[i] - last_time) - SampleDur.ir
			];
		
		last_time = major_hit_times[i];
	};
	
	major_hit_levels = [1.0, 0.3, 0.7, 0.4, 0.65, 0.87, 0.27, 0.4];
	major_hit_impulse_levels = [major_hit_levels, 0 ! major_hit_times.size].lace(major_hit_times.size * 2);
	
	major_hit_impulses = Duty.ar(
		Dseq(major_hit_deltas, 1), K2A.ar(t_trig), Dseq(major_hit_impulse_levels, 1)
		);	

	major_hit_amp = Gate.ar(major_hit_impulses, major_hit_impulses);
		
	major_hit_envGen = EnvGen.ar(Env.perc(0.0, 0.03, 1, -9), major_hit_impulses) * major_hit_amp;
	major_hit_out = major_hit_envGen * WhiteNoise.ar * 0.6;
	
	major_hit_out = major_hit_out + major_hit_impulses;
	
	klank_freq_array = [1383, 2831, 3252, 3446, 4547, 4600, 4832, 5863, 6813, 8683, 11196];
	klank_freq_array.size.do { |i|
	
		klank_freq_array[i] = klank_freq_array[i] * TRand.kr(0.9, 1.1,  Impulse.kr(20));
	};
	klank_out = DynKlank.ar(`[klank_freq_array, nil, 0.2], major_hit_out * 0.05);
	klank_out = DelayC.ar(klank_out, 0.2, 0.009);

	noise = BrownNoise.ar + (WhiteNoise.ar * 0.3) + (PinkNoise.ar * 0.6);
	noise = noise * 0.1;
	noise = noise + Dust.ar(70, 1);
	noise_out = noise * LagUD.ar(major_hit_impulses, 0.0, 0.842);
	
	additional_tinkles = DynKlank.ar(`[ Array.series(8, 1200, 179), nil, 0.7], Dust.ar(18), TRand.kr(2.9, 3.1, Impulse.kr(20)) );
	
	additional_tinkles = additional_tinkles * EnvGen.ar(Env.linen(0.15, 0.3, 0.3, 1.0, -2), t_trig);
	
	initial_impact_pitch_envGen = EnvGen.ar(Env.perc(0.001, 0.03, 1.0, -7), t_trig);
	initial_impact_amp_envGen = EnvGen.ar(Env.perc(0.0, 0.04, 1.0, -9), t_trig);
	initial_impact = SinOsc.ar(initial_impact_pitch_envGen.exprange(20, 4000)) * 0.5;
	initial_impact = initial_impact + LFNoise1.ar(6800, 1.0) * initial_impact_amp_envGen;
	initial_impact = HPF.ar(initial_impact, 100);
	initial_impact = initial_impact + CombC.ar(initial_impact, 0.2, 0.04, 0.2, 0.12);
	output = (klank_out * 0.5) + (major_hit_out * 0.45) + (noise_out * 0.12) + (additional_tinkles * 0.044) + (initial_impact * 0.2);
	
	output = output ! 2;
	Out.ar(audioOutBus, output);
	
}).send(s);


)


x = Synth(\bglass, [\audioOutBus, 0], s);
x.set(\t_trig, 1.0);
raw 6472 chars (focus & ctrl+a+c to copy)
reception
comments
telephon user 26 Aug'11 14:43

a good theme for all this breakage would be: "the failure of the broken window hypothesis"

unculcated user 04 Sep'18 03:20

Can you post index of channels? That track that plays oscillators with FFT data I believe? Really amazed by it