-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-superdirt-atk.scd
64 lines (57 loc) · 2.45 KB
/
setup-superdirt-atk.scd
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
(
s.options.numBuffers = 1024 * 256;
s.options.memSize = 1024 * 128;
s.options.numWireBufs = 64;
s.options.maxNodes = 1024 * 32;
s.options.numOutputBusChannels = 2; // total number of channels output
s.options.numInputBusChannels = 0;
s.waitForBoot {
~dirt = SuperDirt(2, s); // pan across two channels
~dirt.loadSoundFiles;
~dirt.start(57120, 0 ! 6);
};
s.latency = 0.2;
);
// Setup instructions (see also README.md in this directory!):
// Quarks.install("atk-sc3")
// Atk.createUserSupportDir
// Atk.openUserSupportDir
// Install:
// "kernels" from https://github.com/ambisonictoolkit/atk-kernels/releases/
// and "matrices" from https://github.com/ambisonictoolkit/atk-matrices/releases/
(
// Create encoder and decoder
e = FoaEncoderMatrix.newOmni;
// If we use a kernel encoder (such as diffuse) vs matrix we
/// may get some audible glitches because the decoder is
// destroyed before all sound has finished.
// e = FoaEncoderKernel.newDiffuse(3); // 0 to 5
d = FoaDecoderKernel.newCIPIC(12); // id=21 is the large pinnae dummy and id=165 is the small pinnae dummy.
//d = FoaDecoderKernel.newListen(1002);
)
(
// This trick with setting SuperDirt's defaultPanningFunction is from
// a discussion: https://github.com/musikinformatik/SuperDirt/issues/141
// You can see Damián's version here:
// https://github.com/munshkr/nobounds/blob/master/binaural_boot.scd
// We set panning to it goes clockwise around the head.
// Set up so that in "Tidal panning units":
// pan 0.5 is ahead/centre, 0.25 is left, 0.75 is right, 0 (or 1) is behind
// (in this function, it's already been remapped from -1 to 1, so 0 is ahead, -1 and 1 are behind)
DirtPan.defaultPanningFunction = { |signals, numChannels, pan, mul|
var sig = FoaEncode.ar(signals.sum * mul, e);
// angle=0.5pi -> push to plane wave
sig = FoaPush.ar(sig, angle: 0.45pi, theta: pan * -pi, phi: 0);
FoaDecode.ar(sig, d);
};
// Reload synthdefs after replacing panning function
~dirt.loadSynthDefs;
)
SuperDirt.default = ~dirt;
// pan 0 (and 1) is behind, 0.25 is left, 0.5 is ahead, 0.75 is right
(type: \dirt, orbit: 0, s: \sd, pan: 0.75).play
// Play sounds clockwise from centre (behind)
Pbind(*[type: \dirt, orbit: 0, s: \cr, gain: 1.2, pan: Pseq((0,0.125..0.99), 2).trace]).play
(type: \dirt, orbit: 0, s: \sd, pan: rrand(0.2,0.8), gain: 1.2).play
(type: \dirt, orbit: 1, s: \bd, speed: 1, pan: gaussian(0.5, 0.15), gain: 1.4).play;
(type: \dirt, orbit: 0, s: \sd, pan: [0.25,0.75].choose, room: 0.1, size: 0.8).play