formantsettings

select two of 25 filter settings for five bandpass filters and additional vca stage and crossfade between them. filter settings are the vowel formants f1-f5 for a e i o u in different vocal ranges. 0-4:alto, 5-9:bass, 10-14:countertenor, 15-19:soprano, 20-24:tenor. check the help patch for usage.
Author: Simon Iten
License: BSD
Github: lokki/settings/formantsettings.axo

Inlets

frac32 formants follow pitch (if xfade is on pitch side)

int32 select vowel1

int32 select vowel2

frac32.positive xfade vowel1 and vowel2

frac32.positive xfade pitch and formantshift

frac32.bipolar shift formants up/down

Outlets

frac32.positive a2

frac32.positive a3

frac32.positive a4

frac32.positive a5

frac32.bipolar f1

frac32.bipolar f2

frac32.bipolar f3

frac32.bipolar f4

frac32.bipolar f5

Parameters

frac32.u.map smooth out xfade input

frac32.u.map smooth vowel change

Declaration
int32_t val0;
int32_t val1;
int32_t val2;
int32_t val3;
int32_t val4;
int32_t val5;
int32_t val6;
int32_t val7;
int32_t val8;
int32_t valb0;
int32_t valb1;
int32_t valb2;
int32_t valb3;
int32_t valb4;
int32_t valb5;
int32_t valb6;
int32_t valb7;
int32_t valb8;
int32_t xfade;
const int32_t filtersettings[225]{
    // values for 5 bandpass filters, formant 1 to 5,
    // a e i o u, for alto, bass, countertenor, soprano, tenor.
    32191283,  7025375,  2177305,  11301677, -513312,  21746417, 7025375,
    -10038857, 7025375,  2177305,  25206718, 10485760, -7244675, 9651093,
    4194849,   32191283, 2177305,  -7244675, 11301677, -513312,  24652441,
    7025375,   -4650246, 7025375,  2177305, // filter 1
    45367060,  57357107, 59558068, 32191283, 27343087, 41716757, 57807994,
    60610628,  29847925, 21746417, 44407403, 61633409, 62628089, 33087605,
    23517881,  45367060, 65458615, 67915009, 32191283, 27343087, 43087036,
    59558068,  63018578, 32191283, 21746417, // filter2
    77674735,  76354368, 76354368, 78061659, 73993184, 69734917, 72078065,
    74984089,  72078065, 72078065, 77020633, 76354368, 78948755, 76354368,
    77020633,  78948755, 77674735, 79569512, 78061659, 76354368, 75675729,
    74984089,  77674735, 74984089, 76354368, // filter3
    85776452,  83640084, 87793913, 85776452, 85776452, 72826748, 77674735,
    80779778,  74984089, 76016726, 80179573, 80179573, 84185972, 80179573,
    80179573,  89705257, 86799233, 89705257, 88762168, 88762168, 78948755,
    82522931,  83085806, 77674735, 78948755, // filter4
    98361042,  98361042, 98361042, 98361042, 98361042, 77020633, 81370126,
    84077549,  78948755, 79569512, 84185972, 83640084, 86698151, 83640084,
    84723892,  98361042, 98361042, 98361042, 98361042, 98361042, 83085806,
    86596858,  86188962, 80179573, 83640084, // filter5
    84685724,  8468572,  13421772, 47622337, 33714025, 59952752, 33714025,
    4244342,   37827798, 13421772, 67268247, 26780001, 8468572,  42443420,
    13421772,  67268247, 13421772, 33714025, 37827798, 21272041, 67268247,
    26780001,  23867686, 42443420, 13421772, // filter2 amplitudes
    13421772,  4244342,  4244342,  21272041, 4244342,  47622337, 47622337,
    21272041,  11962175, 3371402,  9501881,  16897005, 8468572,  6726824,
    9501881,   3371402,  23867686, 6726824,  10661291, 2386768,  59952752,
    33714025,  16897005, 33714025, 18958757, // filter3 amplitudes
    2127204,   2386768,  2127204,  5343312,  1342177,  47622337, 33714025,
    10661291,  13421772, 5343312,  8468572,  13421772, 2127204,  10661291,
    4244342,   13421772, 1342177,  6726824,  10661291, 1342177,  53433126,
    26780001,  13421772, 33714025, 26780001, // filter4 amplitudes
    134217,    134217,   134217,   238676,   84685,    13421772, 16897005,
    5343312,   1342177,  2127204,  1689700,  13421772, 2127204,  2678000,
    2678000,   424434,   212720,   846857,   424434,   134217,   10661291,
    13421772,  4244342,  6726824,  6726824 // filter5 amplitudes
};
Init
val0 = 0;
val1 = 0;
val2 = 0;
val3 = 0;
val4 = 0;
val5 = 0;
val6 = 0;
val7 = 0;
val8 = 0;
valb0 = 0;
valb1 = 0;
valb2 = 0;
valb3 = 0;
valb4 = 0;
valb5 = 0;
valb6 = 0;
valb7 = 0;
valb8 = 0;
xfade = 0;
Control Rate
xfade = ___SMMLA(xfade - inlet_c, (-1 << 26) + (param_smoothxfade >> 1), xfade);
int64_t j = (int64_t)(inlet_pitch)*inlet_c2;
j += (int64_t)inlet_formantshift * ((128 << 20) - inlet_c2);

val0 = ___SMMLA(val0 - filtersettings[inlet_s1],
                (-1 << 26) + (param_vowelsmooth >> 1), val0);
valb0 = ___SMMLA(valb0 - filtersettings[inlet_s2],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb0);
int64_t a = (int64_t)valb0 * xfade;
a += (int64_t)val0 * ((128 << 20) - xfade);
outlet_f1 = (a >> 27) + (j >> 27);
val1 = ___SMMLA(val1 - filtersettings[inlet_s1 + 25],
                (-1 << 26) + (param_vowelsmooth >> 1), val1);
valb1 = ___SMMLA(valb1 - filtersettings[inlet_s2 + 25],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb1);
int64_t b = (int64_t)valb1 * xfade;
b += (int64_t)val1 * ((128 << 20) - xfade);
outlet_f2 = (b >> 27) + (j >> 27);
val2 = ___SMMLA(val2 - filtersettings[inlet_s1 + 50],
                (-1 << 26) + (param_vowelsmooth >> 1), val2);
valb2 = ___SMMLA(valb2 - filtersettings[inlet_s2 + 50],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb2);
int64_t c = (int64_t)valb2 * xfade;
c += (int64_t)val2 * ((128 << 20) - xfade);
outlet_f3 = (c >> 27) + (j >> 27);
val3 = ___SMMLA(val3 - filtersettings[inlet_s1 + 75],
                (-1 << 26) + (param_vowelsmooth >> 1), val3);
valb3 = ___SMMLA(valb3 - filtersettings[inlet_s2 + 75],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb3);
int64_t d = (int64_t)valb3 * xfade;
d += (int64_t)val3 * ((128 << 20) - xfade);
outlet_f4 = (d >> 27) + (j >> 27);
val4 = ___SMMLA(val4 - filtersettings[inlet_s1 + 100],
                (-1 << 26) + (param_vowelsmooth >> 1), val4);
valb4 = ___SMMLA(valb4 - filtersettings[inlet_s2 + 100],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb4);
int64_t e = (int64_t)valb4 * xfade;
e += (int64_t)val4 * ((128 << 20) - xfade);
outlet_f5 = (e >> 27) + (j >> 27);
val5 = ___SMMLA(val5 - filtersettings[inlet_s1 + 125],
                (-1 << 26) + (param_vowelsmooth >> 1), val5);
valb5 = ___SMMLA(valb5 - filtersettings[inlet_s2 + 125],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb5);
int64_t f = (int64_t)valb5 * xfade;
f += (int64_t)val5 * ((128 << 20) - xfade);
outlet_a2 = f >> 27;
val6 = ___SMMLA(val6 - filtersettings[inlet_s1 + 150],
                (-1 << 26) + (param_vowelsmooth >> 1), val6);
valb6 = ___SMMLA(valb6 - filtersettings[inlet_s2 + 150],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb6);
int64_t g = (int64_t)valb6 * xfade;
g += (int64_t)val6 * ((128 << 20) - xfade);
outlet_a3 = g >> 27;
val7 = ___SMMLA(val7 - filtersettings[inlet_s1 + 175],
                (-1 << 26) + (param_vowelsmooth >> 1), val7);
valb7 = ___SMMLA(valb7 - filtersettings[inlet_s2 + 175],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb7);
int64_t h = (int64_t)valb7 * xfade;
h += (int64_t)val7 * ((128 << 20) - xfade);
outlet_a4 = h >> 27;
val8 = ___SMMLA(val8 - filtersettings[inlet_s1 + 200],
                (-1 << 26) + (param_vowelsmooth >> 1), val8);
valb8 = ___SMMLA(valb8 - filtersettings[inlet_s2 + 200],
                 (-1 << 26) + (param_vowelsmooth >> 1), valb8);
int64_t i = (int64_t)valb8 * xfade;
i += (int64_t)val8 * ((128 << 20) - xfade);
outlet_a5 = i >> 27;

Privacy

© 2024 Zrna Research