frqshift

frequency shifter based on Johannes Taelman's iq-split Converts an audio signal into an "analytic pair" of In-phase (I) and Quadrature-phase (Q) signals. This is not a Hilbert filter, a Hilbert genertates the Q signal from an I signal. Applications include frequency shifting, and envelope following. The filter is a fixed point implementation of the design by Olli Niemitalo. http://dsp.stackexchange.com/questions/26966/oscillations-on-hilbert-envelope
Author: Remco van der Most
License: GPL
Github: sss/fx/frqshift.axo

Inlets

frac32buffer in

Outlets

frac32buffer high

frac32buffer low

Parameters

frac32.u.map shift

Declaration
int32_t s_mid_t1[9];
int32_t s_mid_t2[9];

int32_t *mid_t1;
int32_t *mid_t2;
int32_t phs;
int32_t v30 = 1 << 30;
Init
mid_t1 = &s_mid_t1[0];
mid_t2 = &s_mid_t2[0];
Control Rate
int32_t shift = ___SMMUL(param_shift << 3, param_shift << 2);
shift = ___SMMUL(shift << 3, shift << 2);
Audio Rate
phs += shift;
int32_t SIN, COS;
SINE2TINTERP(phs, SIN)
SINE2TINTERP(phs + v30, COS)
int32_t in_t1 = inlet_in;

int32_t mid0_t =
    ___SMMLA(0.4794008656 * UINT32_MAX, in_t1 + mid_t2[0], mid_t2[8]);
int32_t s1 = mid0_t + mid_t2[1];
int32_t mid1_t = ___SMMLS(UINT32_MAX * (1 - 0.8762184935), s1, s1 - mid_t2[0]);
int32_t s2 = mid1_t + mid_t2[2];
int32_t mid2_t = ___SMMLS(UINT32_MAX * (1 - 0.9765975895), s2, s2 - mid_t2[1]);
int32_t s3 = mid2_t + mid_t2[6];
int32_t out0_t = ___SMMLS(UINT32_MAX * (1 - 0.9974992559), s3, s3 - mid_t2[2]);

int32_t mid3_t =
    ___SMMLA(0.1617584983 * UINT32_MAX, in_t1 + mid_t2[3], mid_t1[8]);
int32_t s4 = mid3_t + mid_t2[4];
int32_t mid4_t = ___SMMLS(UINT32_MAX * (1 - 0.7330289323), s4, s4 - mid_t2[3]);
int32_t s5 = mid4_t + mid_t2[5];
int32_t mid5_t = ___SMMLS(UINT32_MAX * (1 - 0.9453497003), s5, s5 - mid_t2[4]);
int32_t s6 = mid5_t + mid_t2[7];
int32_t out1_t = ___SMMLS(UINT32_MAX * (1 - 0.9905991567), s6, s6 - mid_t2[5]);

// outlet_i = out0_t;
// outlet_q = out1_t;
int32_t t1, t2;
t1 = ___SMMUL(out0_t, SIN) << 1;
t2 = ___SMMUL(out1_t, COS) << 1;
int32_t low = t1 + t2;
int32_t high = t1 - t2;
// outlet_out=low+(___SMMUL(-high-low,param_mix)<<5);
outlet_low = low;
outlet_high = -high;
// swap
int32_t *tmp;
tmp = mid_t2;
mid_t2 = mid_t1;
mid_t1 = tmp;

mid_t1[0] = mid0_t;
mid_t1[1] = mid1_t;
mid_t1[2] = mid2_t;
mid_t1[3] = mid3_t;
mid_t1[4] = mid4_t;
mid_t1[5] = mid5_t;
mid_t1[6] = out0_t;
mid_t1[7] = out1_t;
mid_t1[8] = -in_t1;

Privacy

© 2024 Zrna Research