«Double Oscer» by codepool

on 27 Apr'17 16:12 in oscillator

Migration from the old SourceForge wiki.

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
// Back and forth bouncing between buffered waveforms.

(
s = Server.local;
b = Buffer.alloc(s, 4096, 1);
c = Buffer.alloc(s, 4096, 1);
)

(
SynthDef("Oscer1", {argnextTime = 0.5, bufnum = 0, freq = 80, envLev = 1.0;
	var env, osc, sum, out;
	env = EnvGen.kr(Env.new([0, 1, 1, 0], [0.1, 0.98, 0.1]), levelScale: envLev, timeScale: nextTime*0.98, doneAction: 2);
	osc = Osc.ar(b.bufnum, [freq, freq+(freq*0.0025)], 0, 0.5);//[freq, freq+(freq*0.0025)]
	sum = (env*osc);
	Out.ar(0, sum);
}).send(s);

SynthDef("Oscer2", {argnextTime = 0.5, bufnum = 0, freq = 80, envLev = 1.0;
	varenv, osc, sum, out;
	env = EnvGen.kr(Env.new([0, 1, 1, 0], [0.1, 0.98, 0.1]), levelScale: envLev, timeScale: nextTime*0.98, doneAction: 2);
	osc = Osc.ar(c.bufnum, [freq, freq+(freq*0.0025)], 0, 0.5);
	sum = (env*osc);
	Out.ar(0, sum);
}).store;
)

(
t = TempoClock(110/60);
u = t.beatDur/4;

Routine({argnextTime;
	OSCSched.global.tdeltaTillNext(4.0).wait;
	loop({
		nextTime = u;
		s.sendBundle(nil, [
			\s_new, \Oscer1, 1001, 1, 0, 
			\freq, 26.midicps, 
			\envLev, rrand(0.6, 0.8), 
			\nextTime, nextTime
		]);
		(nextTime*2).wait;
	});
}).play;

Routine({argnextTime;
	varn = 7;
	OSCSched.global.tdeltaTillNext(4.0).wait;
	loop({
		nextTime = u;
		(nextTime*1.5).wait;
		b.sine1(Array.rand(n, 0, 1).cubed, true, true, true);
		(nextTime*0.5).wait;
	});
}).play;

Routine({argnextTime;
	OSCSched.global.tdeltaTillNext(4.0).wait;
	loop({
		nextTime = u;
		nextTime.wait;
		s.sendBundle(nil, [
			\s_new, \Oscer2, 1002, 1, 0, 
			\freq, 38.midicps, 
			\envLev, rrand(0.5, 0.8), 
			\nextTime, nextTime
		]);
		nextTime.wait;
	});
}).play;

Routine({argnextTime;
	varn = 7;
	OSCSched.global.tdeltaTillNext(4.0).wait;
	loop({
		nextTime = u;
		(nextTime*0.5).wait;
		c.sine1(Array.rand(n, 0, 1).cubed, true, true, true);
		(nextTime*1.5).wait;
	});
}).play;

)
/*
authors so far:
Jonathan Segel
*/
raw 1966 chars (focus & ctrl+a+c to copy)
reception
comments