-
Notifications
You must be signed in to change notification settings - Fork 0
/
BufferIRFeedback.scd
51 lines (34 loc) · 1.41 KB
/
BufferIRFeedback.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
(
~fftsize = 2048;
s.waitForBoot {
{
var ir, irbuffer, bufsize;
// // MONO ONLY
// pre-existing impulse response sound files
// (could also use any general soundfile too for cross-synthesis effects)
irbuffer = Buffer.read(s, thisProcess.nowExecutingPath.dirname +/+ "sounds/ConradPrebysConcertHallSeatF111.wav");
s.sync;
bufsize = PartConv.calcBufSize(~fftsize, irbuffer);
// ~numpartitions= PartConv.calcNumPartitions(~fftsize, irbuffer);
~irspectrum = Buffer.alloc(s, bufsize, 1);
~irspectrum.preparePartConv(irbuffer, ~fftsize);
s.sync;
irbuffer.free; // don't need time domain data anymore, just needed spectral version
}.fork;
}
)
~srcBuffer = Buffer.read(s, thisProcess.nowExecutingPath.dirname +/+ "sounds/consynthMono.wav");
(
SynthDef(\helpTap, { |out, bufnum|
var source, sourceRev, indx, capture, sourceOut;
indx = Phasor.ar(0, 1, 0, BufFrames.ir(bufnum), 1);
source = BufRd.ar(1, ~srcBuffer, indx);
sourceRev = source + PartConv.ar(source, ~fftsize, ~irspectrum.bufnum, 0.05);
capture = BufWr.ar(Limiter.ar(sourceRev, 0.5, 0.1), bufnum, indx);
sourceOut = sourceRev * 0.2;
Out.ar(out, [sourceOut, sourceOut]); // multichannel expansion, so one tap each ear
}).add;
)
// { BufRd.ar(1, b, Phasor.ar(0, BufRateScale.kr(b), 0, BufFrames.kr(b))) }.play;
x = Synth(\helpTap, [\bufnum, ~srcBuffer.bufnum]);
x.free;