«Mono2eN - SynthDef» by Callum Goddard

on 26 Mar'13 16:54 in spatialperformance tool

The synthdef version of the mono2eN system - a multichannel autospatilisation musical performance tool.

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
s = Server.internal;
s.boot;

(
SynthDef("4for8", {
	arg width=2, level=0.5;

        // change to match number of output audio channels
	var numChans = 6;

	var in, amp, pos=0, sig, sig2, sig2pan, out, chain, chainSpec, centroid, freq, hasFreq, freq2, hasFreq2;

	in = SoundIn.ar(0);  // input

	# freq, hasFreq = Pitch.kr(
					in,
					ampThreshold: 0.09,
					median: 7);
	freq = freq * hasFreq* 0.01;
	freq.poll;

	chainSpec = FFT(LocalBuf(2048, 1), in);

	centroid = SpecCentroid.kr(chainSpec);

	centroid = ((centroid * 0.0005)-0.3)*10;

	// new possition determined by centroid
	pos = VarLag.kr(
			centroid,
			0.9,
			);  // smooths the position


	// PanAz position of the sound
	sig = PanAz.ar(
		     numChans,
		     in,
		     pos,
		     level,
		     width,
		).scramble;

	chain = FFT({LocalBuf(2048, 1)}.dup(numChans), sig);

	chain = PV_MagFreeze(chain, SinOsc.kr(freq*100));

	sig2 = IFFT(chain);

	sig2pan = SplayAz.ar(
		numChans,
		sig2
	);

	// Mixing wet and dry signal.
	out = sig + sig2pan;
	out = out*0.7;
	Out.ar(0, out);
}).add;

)

(
x = Synth("4for8")

x.set(\width, 5, \level, 0.2)
)
raw 1183 chars (focus & ctrl+a+c to copy)
comments