«OSC etude #1» by emergent

on 20 Mar'21 09:36 in

3 bandpass-filtered sawtooth waves, center frequency of bandpass filter modulated by OSC via the multitouch feature of Sensors2Osc

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
// OSC etude 1

(
s = Server.local;
s.options.sampleRate_(44100);
s.options.memSize_(65536 * 4);
s.boot;

// global variables and buses

~out = 0;

// make buses
~makeBuses = {~revBus = Bus.audio(s, 2)};

// make nodes
~makeNodes = {
	s.bind({
		~mGr = Group.new; // marimba group
		~effects = Group.after(~mGr);
		~reverb = Synth(\reverb, [\in, ~revBus, \out, ~out], ~effects, addAction:\addToTail);
	});
};

~cleanup = {
	s.freeAll;
	Buffer.freeAll;
	OSCdef.freeAll;
	s.newBusAllocators;
	ServerBoot.removeAll;
	ServerTree.removeAll;
	ServerQuit.removeAll;
};

// register functions
ServerBoot.add(~makeBuses);
ServerQuit.add(~cleanup);

// OSCdefs
OSCdef.new(\multi1,
	{
 		arg msg;
		//[msg].postln;
		~marimba[0].set(\rq, msg[1].linlin(0.0,1.0,0.03,0.007));
		~marimba[0].set(\cf, msg[2].linlin(0.0,1.0,110,880));
	},
	'/touch1'
);

OSCdef.new(\multi2,
	{
 		arg msg;
		//[msg].postln;
		~marimba[1].set(\rq, msg[1].linlin(0.0,1.0,0.03,0.007));
		~marimba[1].set(\cf, msg[2].linlin(0.0,1.0,110,880));
	},
	'/touch2'
);

OSCdef.new(\multi3,
	{
 		arg msg;
		//[msg].postln;
		~marimba[2].set(\rq, msg[1].linlin(0.0,1.0,0.03,0.007));
		~marimba[2].set(\cf, msg[2].linlin(0.0,1.0,110,880));
	},
	'/touch3'
);

s.waitForBoot({
	s.sync;
	// SynthDefs
	SynthDef(\marimba, {
		var sig, env, rq;
		rq = \rq.kr(0.03);
		env = Env.asr(\atk.ir(0.25), 0.5, \rel.ir(1)).kr(2, \gate.kr(1));
		sig = LFSaw.ar(
			LFNoise1.kr(
				LFNoise1.kr(6).range(\rmin.kr(2), \rmax.kr(16)),
				0.9,
			).exprange(\fmin.kr(4),\fmax.kr(12))
		)!2;
		sig = BPF.ar(sig, \cf.kr(200), rq, 1/rq.sqrt);
		sig = sig * env * \amp.kr(0.45);
		Out.ar(\out.ir(~out), sig * \dry.kr(1));
		Out.ar(\fx.ir(~revBus), sig * (1-\dry.kr(1)))
	}).add;

	// my go-to reverb
	SynthDef.new(\reverb, {
		var sig;
		sig = JPverb.ar(
			In.ar(\in.ir(~revBus), 2),
			\rtime.kr(4),
			\damp.kr(0.75),
			\size.kr(4.5),
			\earlyDiff.kr(0.8),
			\modDepth.kr(0.12),
			\modFreq.kr(2),
			\low.kr(1),
			\mid.kr(0.9),
			\high.kr(0.8)
		);
		sig = sig * \revAmp.kr(0.5);
	Out.ar(\out.kr(~out), sig);
	}).add;

s.sync;

ServerTree.add(~makeNodes);
s.freeAll;

s.sync;
"done".postln;
});
)
// start performance; modulate up to three of the "marimbas" via multitouch on Sensors2Osc
(
~marimba = 3.collect{
	Synth(\marimba, [\rq, 0.008, \cf, (Scale.minorPentatonic.degrees+49).choose.midicps, \dry, rrand(0.25,0.45)], ~mGr);
};
)

// record if wanted
s.record;
s.stopRecording;

// stop performance
~mGr.set(\gate, 0);

s.quit;
raw 2601 chars (focus & ctrl+a+c to copy)
reception
comments