ReimFilter
Stores and handles filter presets to be used by an Auditory Augmentation setup.
See also (ReimData).
(
ReimFilter.presets[\myReson] = {|in, sreim| // soundin (one channel), dataIn (n channels)
// multichannel controls
var freqs, amps, rings;
var ringtime, highFreq, baseFreq;
// controls (rebuild for 3.2 compatibility)
// creates a control called ringTime with default value 0.1
// ringtime = \ringtime.kr(0.1);
ringtime = Control.names([\ringtime]).kr(#[0.1]);
// highFreq = \highFreq.kr(1000);
highFreq = Control.names([\highFreq]).kr(#[1000]);
// baseFreq = \baseFreq.kr(523);
baseFreq = Control.names([\baseFreq]).kr(#[523]);
freqs = (sreim.collect{|reim, i|
(i + reim) * 24
} + baseFreq.cpsmidi).midicps;
freqs = Select.kr(sreim.abs > 0, [1, freqs]);
amps = sreim > 0;
rings = sreim;
//rings = sreim > 0;
// input HF damping
in = (in + HPF.ar(in, highFreq)) * 0.5;
DynKlank.ar(
`[freqs.lag(0.1), DelayN.kr(amps, 0.1, 0.1), rings * ringtime],
in * 0.25
).tanh;
}
)
/*
ReimFilter.at(\myReson).postcs // */
// ReimFilter assumes normalized Data
(
q = q ? ();
q.data = CSVFileReader.readInterpret("%/resources/glass.csv".format(Document.current.dir));
q.data = q.data.flop[0..8].flop;
)
(
Server.default = s = Server.internal
s.options.blockSize = 32;
s.options.hardwareBufferSize = 32;
s.options.numWireBufs = 64;
s.boot
)
q.reim = ReimData(s, 9);
q.reim.data = q.data.choose; // choose one item of the dataset
// the input
q.sourceChannel = 0;
(
Ndef(\reims, {|amp = 1|
//var in = SoundIn.ar(q.sourceChannel);
var in = Impulse.ar(1);
ReimFilter.ar(\myReson, in*amp, q.reim);
}).playN([0, 1]);
)
Ndef(\reims).set(\ringtime, 0.3)
NdefMixer(s)
// write your newly instantiated presets to a file
ReimFilter.write
ReimFilter.presets.asCompileString
ReimFilter.presetpath.openInFinder