combinor

2 combfilters combined with a differential LP/HP filter. used to mix 4 different signals, 2 for low frequencies and 2 for high frequencies. Due to use of differential subtractions of the filters from the original inputs, each input will fill up different parts of the audio spectrum. combfilter 1 has input 1 and 2 as inputs, but input 2 is subtracted, creating a positive combfilter response for input 1 while having a negative combfilter response for input 2. (when the volume of one's peaks is high, the other's peaks will be low). The same is done for combfilter 2, but this uses input 3 and 4. Here, 4 will be the negative combfilter response. The two combfilters are then fed to a Lowpass filter after which the 2nd combfilter will be subtracted to get a HP response for this channel. So the 1st combfilter only has the low part of the spectrum and the 2nd combfilter will be in the high part spectrum. The combfilter frequencies are controlled with "pitch1" and "pitch2" respectively The LP/HP filter cutoff frequency is controlled with "cut" Both the combfilters as well as the filter have feedback control: -The feedback of the combfilters is controlled with feed1 and feed2 respecively. The filter resonance can be added to two positions: -before the combfilter, creating lots of resonance and weird harmonic-shifting behavior->res1 control -after the combfilter, back into the filter itself-> res2 control
Author: Remco van der Most
License: BSD
Github: sss/filter/combinor.axo

Inlets

frac32buffer delay time (fraction of total delayline size)

frac32buffer in2

frac32buffer in3

frac32buffer in4

frac32 pitch1

frac32 pitch2

frac32 cut

Outlets

frac32buffer out

Parameters

frac32.s.map.pitch pitch1

frac32.s.map.pitch pitch2

frac32.s.map.pitch cut

frac32.s.map feed1

frac32.s.map feed2

frac32.s.map res1

frac32.s.map res2

Attributes

combo size

Declaration
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
int32_t *array1;
int32_t *array2;
uint32_t writepos;

int32_t Time1;
int32_t prev1;
int32_t step1;
int32_t Time2;
int32_t prev2;
int32_t step2;
int32_t out1;
int32_t out2;
int32_t val;
int32_t res;
int32_t Res;
Init
static int32_t _array1[attr_poly][1 << attr_size]
    __attribute__((section(".sdram")));
static int32_t _array2[attr_poly][1 << attr_size]
    __attribute__((section(".sdram")));
array1 = &_array1[parent->polyIndex][0];
array2 = &_array2[parent->polyIndex][0];
int i;
writepos = 0;
for (i = 0; i < LENGTH; i++) {
  array1[i] = 0;
  array2[i] = 0;
}
Control Rate
int32_t fraq1;
MTOF(-param_pitch1 - inlet_pitch1, fraq1);
int32_t fraq2;
MTOF(-param_pitch2 - inlet_pitch2, fraq2);
int32_t times1 = __USAT(fraq1 >> 4, 27);
step1 = (times1 - prev1) >> 4;
Time1 = prev1;
prev1 = times1;
int32_t times2 = __USAT(fraq2 >> 4, 27);
step2 = (times2 - prev2) >> 4;
Time2 = prev2;
prev2 = times2;

int32_t freq;
MTOF(param_cut + inlet_cut, freq)
Audio Rate
Time1 += step1;
Time2 += step2;
writepos = (writepos + 1) & LENGTHMASK;
array1[writepos] =
    __SSAT(inlet_in1 + inlet_in2 + ___SMMUL(out1 << 3, param_feed1 << 4), 30) +
    Res;
array2[writepos] =
    __SSAT(inlet_in3 + inlet_in4 + ___SMMUL(out2 << 3, param_feed2 << 4), 30) +
    Res;
// array1[writepos] =
// __SSAT(inlet_in1+inlet_in2+___SMMUL(Res<<3,param_feed<<4),30);
// array2[writepos] =
// __SSAT(inlet_in3+inlet_in4+___SMMUL(Res<<3,param_feed<<4),30);
uint32_t tmp_d = Time1;
uint32_t tmp_di = writepos - (tmp_d >> (27 - LENGTHPOW));
uint32_t tmp_w1 = (tmp_d << (LENGTHPOW + 3)) & 0x3FFFFFFF;
uint32_t tmp_w2 = (1 << 30) - tmp_w1;
int32_t tmp_a1 = array1[tmp_di & LENGTHMASK];
int32_t tmp_a2 = array1[(tmp_di + 1) & LENGTHMASK];
int32_t tmp_r = ___SMMUL(tmp_a1, tmp_w1);
tmp_r = ___SMMLA(tmp_a2, tmp_w2, tmp_r);
out1 = tmp_r + inlet_in1 - inlet_in2 + ___SMMUL(Res << 3, param_res2);

tmp_d = Time2;
tmp_di = writepos - (tmp_d >> (27 - LENGTHPOW));
tmp_w1 = (tmp_d << (LENGTHPOW + 3)) & 0x3FFFFFFF;
tmp_w2 = (1 << 30) - tmp_w1;
tmp_a1 = array2[tmp_di & LENGTHMASK];
tmp_a2 = array2[(tmp_di + 1) & LENGTHMASK];
tmp_r = ___SMMUL(tmp_a1, tmp_w1);
tmp_r = ___SMMLA(tmp_a2, tmp_w2, tmp_r);
out2 = tmp_r + inlet_in3 - inlet_in4 - ___SMMUL(Res << 3, param_res2);
int32_t sum;
sum = out1 + out2;
val = ___SMMLA((sum - val) << 1, freq, val);
res = ___SMMLA((val - out2 - res) << 1, freq, res);
outlet_out = val - out2 >> 1;
Res = __SSAT(___SMMUL(val - out2 - res << 3, param_res1 << 2), 25) << 1;

Privacy

© 2024 Zrna Research