mirror of
https://github.com/ruppert/fmini-1.git
synced 2026-12-05 12:24:36 +01:00
FMini-1 FILT: LP / HP switch under CUTOFF (FT_HP, bit 4 of SW2)
A high-pass output: (1 - LP)^4 of the ladder's own four stages, 24 dB/oct, on the same loop (the EMPHASIS feedback is still the low-pass one). The switch is a field of the FILT page (CC 72, free), drawn left of the response; the response graph and its caption follow the choice (FMINI_GRAPH_HP, generated by tools/fmini_filter.py; the LP table is unchanged). fmini_sanitize keeps SW2 up to 7 (it kept 3). Settings layout 0x51 (the controls grew by one). Patches saved before have the bit clear: LP, as before. Test: a C2 is cut 18.6 dB and a C7 passes +14 dB (a saw's harmonics pass the high-pass; the bar is 14 dB). The full suite: only the known failures. Protocol note in web/EDITOR_PROTOCOL.md. Emulator regenerated (docs/emu2). Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
This commit is contained in:
8 files changed
+110
-26
No files matched your search
Binary file not shown.
@@ -44,7 +44,7 @@ enum { /* the patch's bytes */
|
||||
FG_NUM
|
||||
};
|
||||
enum { FS_O1 = 1, FS_O2 = 2, FS_O3 = 4, FS_NZ = 8, FS_PINK = 16, FS_MOSC = 32, FS_MFLT = 64 }; /* FG_SW1 */
|
||||
enum { FT_GLIDE = 1, FT_SQR = 2 }; /* FG_SW2 */
|
||||
enum { FT_GLIDE = 1, FT_SQR = 2, FT_HP = 4 }; /* FG_SW2 (FT_HP: the high-pass output, 1.x) */
|
||||
|
||||
/* DET 2 / 3, in cents: the signed 16-bit at bytes lo, lo + 1 (FG_DC2L, FG_DC3L). The coarse byte FG_F2 / FG_F3 (64 = 0,
|
||||
* 11 cents a step) is what a CC writes and is kept near the cents for the editor; the sound uses the cents (1.14.12). */
|
||||
@@ -84,7 +84,7 @@ static int32_t fmini_mn[NTRK]; /* the modulation noise of thi
|
||||
/* the highest value of each byte */
|
||||
static uint32_t fmini_max(uint32_t i)
|
||||
{
|
||||
static const uint8_t MAXV[FG_NUM] = {5, 5, 5, 5, 5, 5, 127, 127, 127, 127, 127, 127, 127, 3, 127, 127, 127, 127, 127, 15, 127, 15, 127, 127};
|
||||
static const uint8_t MAXV[FG_NUM] = {5, 5, 5, 5, 5, 5, 127, 127, 127, 127, 127, 127, 127, 7, 127, /* FG_SW2: FT_GLIDE, FT_SQR, FT_HP */ 127, 127, 127, 127, 15, 127, 15, 127, 127};
|
||||
return i < FG_NUM ? MAXV[i] : 0u;
|
||||
}
|
||||
|
||||
@@ -412,6 +412,7 @@ static void fmini_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const
|
||||
int32_t mix[CTL];
|
||||
int32_t env15, mod, lfo, vib, lc, p16, fine, k12, G16, gx16, c0, c1, c2, c3, inv14, kinv12, trim12;
|
||||
int32_t l1 = 0, l2 = 0, l3 = 0, ln = 0, dr1, dr2, dr3;
|
||||
uint32_t hp = (uint32_t)(g[FG_SW2] & FT_HP) ? 1u : 0u; /* the output: LP (the last stage) or HP ((1 - LP)^4 of the same stages) */
|
||||
uint32_t tr = (uint32_t)(t - trk) % NTRK, i, sw = g[FG_SW1];
|
||||
uint32_t inc1, inc2, inc3;
|
||||
int32_t s0 = v->s[0], s1 = v->s[1], s2 = v->s[2], s3 = v->s[3], sx = v->s[4];
|
||||
@@ -511,11 +512,12 @@ static void fmini_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
int32_t x = softclip(mix[i]), S, fbc, u, v1, v2, v3, v4, y1, y2, y3, y4, w; /* the mixer overloads softly */
|
||||
int32_t x = softclip(mix[i]), S, fbc, u, xin, v1, v2, v3, v4, y1, y2, y3, y4, w, o; /* the mixer overloads softly */
|
||||
S = (c0 * ((s0 + 128) >> 8) + c1 * ((s1 + 128) >> 8) + c2 * ((s2 + 128) >> 8) + c3 * ((s3 + 128) >> 8)) >> 14; /* what the stages already hold */
|
||||
fbc = sx + fmini_mulr((S << 8) - sx, (uint32_t)gx16); /* through the lag pole (Q8) */
|
||||
u = ((x * inv14) >> 14) - ((kinv12 * ((fbc + 128) >> 8)) >> 12); /* the input less the feedback, the loop solved */
|
||||
v1 = fmini_mulr((softclip(u) << 8) - s0, (uint32_t)G16); /* each stage is a differential pair: tanh in front of it */
|
||||
xin = softclip(u) << 8; /* the first stage's input (Q8) */
|
||||
v1 = fmini_mulr(xin - s0, (uint32_t)G16); /* each stage is a differential pair: tanh in front of it */
|
||||
y1 = v1 + s0;
|
||||
s0 = y1 + v1;
|
||||
v2 = fmini_mulr((softclip((y1 + 128) >> 8) << 8) - s1, (uint32_t)G16);
|
||||
@@ -529,7 +531,9 @@ static void fmini_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const
|
||||
s3 = y4 + v4;
|
||||
w = fmini_mulr(y4 - sx, (uint32_t)gx16); /* the lag pole follows the output */
|
||||
sx += w + w;
|
||||
out[i] += voice_amp((((y4 + 128) >> 8) * trim12) >> 12, m, i) << 1;
|
||||
/* HP: the stages are one-pole lows H; (1 - H)^4 = 1 - 4H + 6H^2 - 4H^3 + H^4 on the stages' outputs (linear, the states as they are) */
|
||||
o = hp ? xin - 4 * y1 + 6 * y2 - 4 * y3 + y4 : y4;
|
||||
out[i] += voice_amp((((o + 128) >> 8) * trim12) >> 12, m, i) << 1;
|
||||
}
|
||||
v->ph[0] = ph0;
|
||||
v->ph[1] = ph1;
|
||||
|
||||
@@ -84,6 +84,26 @@ static const int16_t FMINI_GRAPH[17][73] = { /* the FILT page's response: EMPH
|
||||
{-106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -105, -105, -105, -105, -105, -104, -104, -104, -103, -103, -102, -101, -100, -99, -98, -96, -94, -92, -89, -85, -81, -76, -69, -60, -49, -32, -8, 37, 226, 23, -29, -61, -86, -108, -127, -144, -161, -178, -196, -213, -232, -250, -270, -290, -311, -332, -354, -376, -398, -400, -400, -400, -400},
|
||||
};
|
||||
|
||||
static const int16_t FMINI_GRAPH_HP[17][73] = { /* the same for FT_HP (the high-pass output), dB x 8 */
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -379, -357, -334, -313, -291, -270, -250, -230, -211, -193, -175, -158, -142, -127, -113, -101, -89, -78, -68, -59, -51, -44, -38, -33, -28, -24, -20, -17, -15, -12, -11, -9, -8, -6, -5, -5},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -380, -358, -336, -314, -292, -271, -251, -231, -212, -193, -176, -159, -143, -128, -114, -102, -90, -79, -69, -60, -52, -45, -39, -34, -29, -25, -21, -18, -16, -14, -12, -10, -9, -7, -7, -6},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -381, -358, -336, -314, -292, -271, -250, -231, -211, -193, -175, -159, -143, -128, -114, -102, -90, -79, -69, -60, -53, -46, -39, -34, -29, -25, -22, -19, -16, -14, -12, -10, -9, -8, -7, -6},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -380, -357, -335, -312, -290, -269, -248, -228, -209, -190, -173, -156, -141, -126, -113, -100, -88, -78, -68, -59, -52, -45, -38, -33, -28, -24, -21, -18, -15, -13, -11, -9, -8, -7, -6, -5},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -384, -360, -336, -312, -288, -265, -243, -222, -202, -184, -167, -151, -136, -123, -110, -98, -87, -77, -68, -59, -52, -45, -39, -33, -28, -24, -21, -18, -15, -13, -11, -9, -8, -7, -6, -5},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -395, -368, -342, -316, -289, -262, -237, -212, -189, -170, -153, -139, -127, -116, -105, -95, -86, -77, -68, -60, -52, -45, -39, -33, -28, -24, -21, -17, -15, -13, -11, -9, -8, -6, -5, -5},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -384, -356, -328, -299, -269, -238, -206, -177, -151, -133, -122, -114, -108, -101, -93, -85, -77, -69, -61, -54, -47, -41, -35, -30, -26, -22, -19, -16, -14, -12, -10, -9, -8, -7, -6},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -395, -367, -339, -309, -278, -245, -210, -175, -143, -121, -112, -108, -105, -100, -94, -88, -80, -72, -65, -57, -51, -44, -39, -34, -29, -26, -22, -20, -17, -15, -14, -12, -11, -10, -9},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -375, -346, -316, -284, -251, -215, -177, -139, -112, -104, -104, -104, -101, -96, -89, -82, -75, -67, -60, -53, -47, -41, -36, -32, -28, -25, -22, -20, -18, -16, -15, -14, -13, -12},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -379, -351, -321, -289, -255, -219, -179, -135, -101, -93, -98, -100, -99, -95, -89, -82, -75, -68, -60, -54, -47, -42, -37, -32, -28, -25, -22, -20, -18, -16, -15, -14, -13, -12},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -386, -357, -327, -295, -262, -225, -183, -135, -88, -79, -91, -97, -98, -95, -90, -84, -77, -69, -62, -55, -49, -43, -38, -34, -30, -26, -24, -21, -19, -18, -16, -15, -14, -13},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -394, -365, -335, -304, -270, -233, -191, -141, -78, -61, -84, -95, -98, -97, -92, -86, -79, -72, -65, -58, -52, -46, -41, -36, -33, -29, -26, -24, -22, -20, -19, -18, -17, -16},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -372, -343, -311, -278, -242, -201, -150, -77, -14, -70, -90, -96, -96, -92, -87, -80, -73, -66, -59, -53, -47, -42, -37, -33, -30, -27, -25, -23, -21, -19, -18, -17, -16},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -378, -349, -318, -285, -249, -209, -161, -92, 122, -57, -85, -94, -95, -92, -87, -80, -73, -66, -59, -53, -47, -42, -37, -33, -30, -27, -25, -23, -21, -20, -18, -17, -17},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -378, -349, -318, -285, -249, -209, -161, -92, 122, -57, -85, -94, -95, -92, -87, -80, -73, -66, -59, -53, -47, -42, -37, -33, -30, -27, -25, -23, -21, -20, -18, -17, -17},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -378, -349, -318, -285, -249, -209, -161, -92, 122, -57, -85, -94, -95, -92, -87, -80, -73, -66, -59, -53, -47, -42, -37, -33, -30, -27, -25, -23, -21, -20, -18, -17, -17},
|
||||
{-400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -378, -349, -318, -285, -249, -209, -161, -92, 122, -57, -85, -94, -95, -92, -87, -80, -73, -66, -59, -53, -47, -42, -37, -33, -30, -27, -25, -23, -21, -20, -18, -17, -17},
|
||||
};
|
||||
|
||||
static const uint32_t FMINI_G[122] = { /* stage pole G = g/(1+g), Q24, per semitone of the singing pitch */
|
||||
35796, 37919, 40169, 42551, 45075, 47748,
|
||||
50578, 53576, 56751, 60114, 63675, 67446,
|
||||
|
||||
+38
-14
@@ -259,6 +259,20 @@ static void fa_switch(uint32_t pg, uint32_t ex, int32_t cx, int hot)
|
||||
fa_ctext(cx, 182, &AF_X, on ? "ON" : "OFF", on ? FA_OR : FA_MU);
|
||||
}
|
||||
|
||||
/* FILT: the LP / HP button under CUTOFF: a sliding box, LP at its left and HP at its right, the chosen word orange */
|
||||
static void fa_lphp(int hot)
|
||||
{
|
||||
int on = (fmg_byte(FG_SW2) & FT_HP) != 0u;
|
||||
int32_t x = 24, y = 150, w = 24, h = 12, ty = y + (h - fa_cap_h(&AF_X)) / 2;
|
||||
if (hot)
|
||||
cv_frame(x - 3, y - 3, w + 6, h + 6, FA_OR);
|
||||
cv_rect(x, y, w, h, FA_RGB(0x4A, 0x44, 0x3D));
|
||||
cv_rect(x + 1, y + 1, w - 2, h - 2, FA_RGB(0x0D, 0x0C, 0x0B));
|
||||
cv_rect(on ? x + w / 2 : x + 2, y + 2, w / 2 - 2, h - 4, on ? FA_OR : FA_RGB(0xD9, 0xD2, 0xC0));
|
||||
fa_rtext(x - 4, ty, &AF_X, "LP", on ? FA_MU : FA_OR);
|
||||
fa_ltext(x + w + 4, ty, &AF_X, "HP", on ? FA_OR : FA_MU);
|
||||
}
|
||||
|
||||
/* MIXER: the noise colour, a button under NOISE: ON = PINK, OFF = WHITE, the text always in the ON colour */
|
||||
static void fa_noise_btn(int32_t cx, int hot)
|
||||
{
|
||||
@@ -300,31 +314,39 @@ static void fa_graph(uint32_t pg)
|
||||
fmg_card_at(pg, j, -1, &lb, val, &un, &ratio, &ic);
|
||||
k[j] = ratio < 0 ? 0 : ratio; /* 0..1000 */
|
||||
}
|
||||
cv_rect(14, 146, 212, 46, FA_LINE);
|
||||
cv_rect(15, 147, 210, 44, FA_BOX);
|
||||
if (pg == 3u) { /* the ladder's response: FMINI_GRAPH, the cutoff's singing pitch moving across it */
|
||||
/* FILT: the response sits right of the LP / HP button (fa_lphp); the other pages: the full width */
|
||||
if (pg == 3u) {
|
||||
cv_rect(70, 146, 156, 46, FA_LINE);
|
||||
cv_rect(71, 147, 154, 44, FA_BOX);
|
||||
} else {
|
||||
cv_rect(14, 146, 212, 46, FA_LINE);
|
||||
cv_rect(15, 147, 210, 44, FA_BOX);
|
||||
}
|
||||
if (pg == 3u) { /* the ladder's response: FMINI_GRAPH (LP) or FMINI_GRAPH_HP, the cutoff's singing pitch moving across it */
|
||||
const int16_t (*T)[73] = (fmg_byte(FG_SW2) & FT_HP) ? FMINI_GRAPH_HP : FMINI_GRAPH;
|
||||
const int32_t gx = 72, gw = 150; /* the drawing's left edge and width */
|
||||
int32_t fo = FMINI_CUT[clamp((int32_t)TSEL->p[P_E0], 0, 127)], e = clamp((int32_t)TSEL->p[P_E1], 0, 127), er, ef, px = 0, py = 0, xs;
|
||||
er = e >= 120 ? 15 : e >> 3; /* between two of the table's 17 emphasis rows (0, 8 .. 120, 127) */
|
||||
ef = e >= 120 ? (e - 120) * 256 / 7 : (e & 7) * 32;
|
||||
xs = 17 + (fo - 24 * 16) * 206 / (112 * 16); /* the singing pitch: a dotted line (the screen: MIDI 24 .. 136) */
|
||||
xs = gx + (fo - 24 * 16) * gw / (112 * 16); /* the singing pitch: a dotted line (the screen: MIDI 24 .. 136) */
|
||||
for (i = 0; i < 44; i += 4)
|
||||
cv_pset(xs, 148 + i, FA_MU);
|
||||
for (i = 0; i <= 206; i += 2) {
|
||||
int32_t c = (((24 * 16 + i * (112 * 16) / 206) - fo) * 256 / 24) + 48 * 256, ix, fr, a, b, db, y;
|
||||
for (i = 0; i <= gw; i += 2) {
|
||||
int32_t c = (((24 * 16 + i * (112 * 16) / gw) - fo) * 256 / 24) + 48 * 256, ix, fr, a, b, db, y;
|
||||
c = clamp(c, 0, 71 * 256);
|
||||
ix = c >> 8;
|
||||
fr = c & 255;
|
||||
a = FMINI_GRAPH[er][ix] + (((FMINI_GRAPH[er][ix + 1] - FMINI_GRAPH[er][ix]) * fr) >> 8);
|
||||
b = FMINI_GRAPH[er + 1][ix] + (((FMINI_GRAPH[er + 1][ix + 1] - FMINI_GRAPH[er + 1][ix]) * fr) >> 8);
|
||||
a = T[er][ix] + (((T[er][ix + 1] - T[er][ix]) * fr) >> 8);
|
||||
b = T[er + 1][ix] + (((T[er + 1][ix + 1] - T[er + 1][ix]) * fr) >> 8);
|
||||
db = (a + (((b - a) * ef) >> 8)) / 8;
|
||||
y = 190 - (clamp(db, -50, 30) + 50) / 2; /* -50 .. +30 dB over the 40 rows */
|
||||
x = 17 + i;
|
||||
x = gx + i;
|
||||
if (i)
|
||||
cv_line_t(px, py, x, y, FA_OR, 2);
|
||||
px = x;
|
||||
py = y;
|
||||
}
|
||||
fa_ltext(18, 198, &AF_X, "24 DB/OCT LADDER LOW PASS", FA_MU);
|
||||
fa_ltext(70, 198, &AF_X, (fmg_byte(FG_SW2) & FT_HP) ? "24 DB/OCT LADDER HIGH PASS" : "24 DB/OCT LADDER LOW PASS", FA_MU);
|
||||
} else { /* a contour: attack, decay, sustain, release */
|
||||
int32_t a = 5 + k[0] * 25 / 1000, dd = 5 + k[1] * 30 / 1000, su = k[2] * 2 / 10 - 100;
|
||||
pt[0] = 0; pt[1] = -100;
|
||||
@@ -978,7 +1000,7 @@ static uint32_t fa_sound_keys(void)
|
||||
* SELECT picks a line, ALGORITHM changes it (or opens MIDI CC / ABOUT); GLO goes back, then closes. The settings are
|
||||
* kept in the flash settings record (favorites.factory rows 7 to 9: no engine of this firmware uses them).
|
||||
* MIDI CLOCK (OFF by default: the internal clock, or USB / TRS) makes the ARP and the SEQ follow that input's MIDI clock. */
|
||||
#define FA_NPG 45u /* the controls of the seven screens (FMG_PAGE: 8+8+9+4+4+4+8; CTRL's VOICES has no CC) */
|
||||
#define FA_NPG 46u /* the controls of the seven screens (FMG_PAGE: 8+8+9+5+4+4+8; CTRL's VOICES has no CC) */
|
||||
#define FA_NCC (FA_NPG + FA_AR_N) /* .. and the ARP pop-up's six lines */
|
||||
static uint8_t fa_gl; /* 0 closed, 1 the list, 2 MIDI CC, 3 ABOUT */
|
||||
static uint8_t fa_gl_row; /* 0 MIDI IN, 1 CHANNEL, 2 MIDI CC, 3 MIDI CLOCK, 4 PITCH BEND, 5 TUNING, 6 TRANSPOSE, 7 ABOUT */
|
||||
@@ -999,7 +1021,7 @@ static const uint8_t FA_CC0[FA_NCC] = {
|
||||
20, 5, 21, 22, 23, 24, 25, 26, /* CTRL: TUNE GLIDE MOD MIX LFO RATE, MOD OSC MOD FLT GLIDE LFO SQR */
|
||||
27, 28, 29, 30, 31, 33, 34, 62, /* OSC: ranges, DETUNE 2, waves, DETUNE 3 */
|
||||
35, 36, 37, 39, 40, 41, 42, 43, 63, /* MIX: levels, NOISE, switches, the noise colour (PINK / WHITE; 63 is free) */
|
||||
74, 71, 44, 45, /* FILT */
|
||||
74, 71, 44, 45, 72, /* FILT: CUTOFF EMPHASIS CONTOUR KBD CTRL, the LP / HP (72 is free) */
|
||||
46, 47, 48, 49, /* F.ENV */
|
||||
73, 75, 50, 7, /* A.ENV: ATTACK DECAY SUSTAIN LEVEL */
|
||||
91, 94, 93, 51, 52, 53, 54, 55, /* FX: REVERB DELAY CHORUS DRIVE, switches */
|
||||
@@ -1013,7 +1035,7 @@ static uint8_t *fa_cfg_byte(uint32_t i) { return &favorites.factory[7u + i / 32u
|
||||
static void fa_cfg_load(void)
|
||||
{
|
||||
uint32_t i;
|
||||
if (*fa_cfg_byte(0) == 0xA7u && *fa_cfg_byte(1) == 0x50u) { /* 0x50: the controls' layout with MIXER's ninth (1.x kept 0x4F) */
|
||||
if (*fa_cfg_byte(0) == 0xA7u && *fa_cfg_byte(1) == 0x51u) { /* 0x51: the controls' layout with FILT's LP / HP (0x50: MIXER's ninth) */
|
||||
uint32_t src = *fa_cfg_byte(2), ch = *fa_cfg_byte(3);
|
||||
fm_midi_src = (uint8_t)(src == 0u || src == 1u ? src : 3u); /* (2 was Bluetooth) */
|
||||
fm_midi_ch = (uint8_t)(ch > 16u ? 0u : ch);
|
||||
@@ -1052,7 +1074,7 @@ static void fa_cfg_save(void)
|
||||
fa_cfg_dirty = 0;
|
||||
fmg_gdirty = 0;
|
||||
*fa_cfg_byte(0) = 0xA7;
|
||||
*fa_cfg_byte(1) = 0x50;
|
||||
*fa_cfg_byte(1) = 0x51;
|
||||
*fa_cfg_byte(2) = fm_midi_src;
|
||||
*fa_cfg_byte(3) = fm_midi_ch;
|
||||
for (i = 0; i < FA_NCC; i++)
|
||||
@@ -1446,6 +1468,8 @@ static void fa_scene(void)
|
||||
fa_wave_boxes(pg, cur);
|
||||
} else if (pg == 3u || pg == 4u || pg == 5u) {
|
||||
fa_graph(pg);
|
||||
if (pg == 3u)
|
||||
fa_lphp(cur == 4u); /* FILT: the LP / HP button under CUTOFF, left of the response */
|
||||
} else if (pg == 6u) { /* FX: DECAY TEMPO RATE TONE under their sends, a thin bar between the four sections */
|
||||
fa_ctext(120, 170, &AF_S, "Press FX to edit effects.", FA_MU); /* under the four knobs */
|
||||
} else {
|
||||
|
||||
@@ -43,8 +43,9 @@ static const struct { const char *name; uint8_t n; fmgf_t f[FMG_NF]; } FMG_PAGE[
|
||||
{"OSC 1", FK_SW, FG_SW1, FS_O1, ICON_LEVEL}, {"OSC 2", FK_SW, FG_SW1, FS_O2, ICON_LEVEL},
|
||||
{"OSC 3", FK_SW, FG_SW1, FS_O3, ICON_LEVEL}, {"NOISE", FK_SW, FG_SW1, FS_NZ, ICON_NOISE},
|
||||
{"NOISE", FK_SW, FG_SW1, FS_PINK, ICON_NOISE}}},
|
||||
{"FILTER", 4, {{"CUTOFF", FK_PAR, P_E0, 0, ICON_CUTOFF}, {"EMPHASIS", FK_PAR, P_E1, 0, ICON_RESO},
|
||||
{"CONTOUR", FK_PAR, P_E2, 0, ICON_SWEEP}, {"KBD CTRL", FK_BYTE, FG_KBD, 0, ICON_KEYTRACK}}},
|
||||
{"FILTER", 5, {{"CUTOFF", FK_PAR, P_E0, 0, ICON_CUTOFF}, {"EMPHASIS", FK_PAR, P_E1, 0, ICON_RESO},
|
||||
{"CONTOUR", FK_PAR, P_E2, 0, ICON_SWEEP}, {"KBD CTRL", FK_BYTE, FG_KBD, 0, ICON_KEYTRACK},
|
||||
{"LP/HP", FK_SW, FG_SW2, FT_HP, ICON_CUTOFF}}}, /* the button under CUTOFF: LP (left) or HP (right) */
|
||||
{"FILTER CONTOUR", 4, {{"ATTACK", FK_PAR, P_E3, 0, ICON_ATTACK}, {"DECAY", FK_PAR, P_E4, 0, ICON_DECAY},
|
||||
{"SUSTAIN", FK_PAR, P_E5, 0, ICON_SUSTAIN}, {"AMOUNT", FK_PAR, P_E2, 0, ICON_SWEEP}}},
|
||||
{"LOUDNESS CONTOUR", 4, {{"ATTACK", FK_PAR, P_ATK, 0, ICON_ATTACK}, {"DECAY", FK_PAR, P_DEC, 0, ICON_DECAY},
|
||||
@@ -438,7 +439,7 @@ static void fmg_card_at(uint32_t pg, uint32_t i, int32_t vo, const char **label,
|
||||
case FK_BYP:
|
||||
case FK_INS:
|
||||
v = vo >= 0 ? vo : (int32_t)fmg_sw_on(f);
|
||||
str_cpy(val, f->a == FS_PINK ? (v ? "PINK" : "WHITE") : (v ? "ON" : "OFF"), 12); /* the noise colour: PINK or WHITE */
|
||||
str_cpy(val, f->a == FS_PINK ? (v ? "PINK" : "WHITE") : f->b == FT_HP ? (v ? "HP" : "LP") : (v ? "ON" : "OFF"), 12); /* the noise colour, the filter's LP / HP */
|
||||
return;
|
||||
case FK_NAME:
|
||||
v = clamp(vo >= 0 ? vo : (int32_t)fmg_byte(f->a), 0, 5);
|
||||
|
||||
@@ -378,5 +378,29 @@ int main(int argc, char **argv)
|
||||
check("the mod wheel at 0 leaves the pitch still; at 127 it sways about a semitone (MOD OSC off)",
|
||||
cents(hi[0], lo[0]) < 10 && cents(hi[1], lo[1]) > 80 && cents(hi[1], lo[1]) < 220);
|
||||
}
|
||||
{ /* 6. FT_HP (FG_SW2 bit 4): the high-pass output, (1 - LP)^4 of the same stages: a low note is cut, a high one passes */
|
||||
static double yl[FS / 2], yh[FS / 2];
|
||||
double lo_lp, lo_hp, hi_lp, hi_hp;
|
||||
uint32_t a = FS / 8, b = FS / 2;
|
||||
int k;
|
||||
for (k = 0; k < 4; k++) {
|
||||
setup(64, 0, 0, FS_O1); /* the dial at 0, no EMPHASIS: a plain ladder */
|
||||
if (k & 1) { pv[FG_SW2] = FT_HP; fmini_set_patch(0, pv); fmini_slot[0] = FMINI_OWN; }
|
||||
play(k < 2 ? 36u : 96u, k < 2 ? yl : yh, FS / 2); /* a C2 (65 Hz) and a C7 (2.1 kHz) */
|
||||
{
|
||||
double r = 0;
|
||||
uint32_t i;
|
||||
for (i = a; i < b; i++) r += (k < 2 ? yl[i] : yh[i]) * (k < 2 ? yl[i] : yh[i]);
|
||||
r = sqrt(r / (b - a));
|
||||
if (k == 0) lo_lp = r; else if (k == 1) lo_hp = r; else if (k == 2) hi_lp = r; else hi_hp = r;
|
||||
}
|
||||
}
|
||||
printf(" HP: C2 LP %.0f HP %.0f (%.1f dB), C7 LP %.0f HP %.0f (%+.1f dB)\n", lo_lp, lo_hp,
|
||||
20 * log10(lo_hp / lo_lp), hi_lp, hi_hp, 20 * log10(hi_hp / hi_lp));
|
||||
/* the wave is a saw: its harmonics above the corner pass the high-pass, so the low note's rms falls ~19 dB, not the
|
||||
* 48 dB of the fundamental alone; the bar is 14 dB */
|
||||
check("FT_HP: the high-pass output cuts a low note by 14 dB or more and passes a high one more than the low-pass",
|
||||
lo_hp < lo_lp * 0.2 && hi_hp > hi_lp * 1.5);
|
||||
}
|
||||
return bad ? 1 : 0;
|
||||
}
|
||||
+10
-3
@@ -148,9 +148,10 @@ def tables():
|
||||
return cut, kq, trim, m0, G, GX
|
||||
|
||||
|
||||
def graph_rows():
|
||||
def graph_rows(hp=False):
|
||||
"""the FILT page's response drawing: 17 rows (EMPHASIS 0, 8 .. 120, 127) x 73 columns (the frequency from 6 octaves
|
||||
below the singing pitch to 3 above, an eighth of an octave a column): dB x 8, clamped to -50 .. +30 dB"""
|
||||
below the singing pitch to 3 above, an eighth of an octave a column): dB x 8, clamped to -50 .. +30 dB.
|
||||
hp: the high-pass output (FT_HP): (1 - H)^4 = (jw / (1 + jw))^4 over the same loop (eng_fmini.c fmini_render)"""
|
||||
import numpy as np
|
||||
rows = []
|
||||
for r in range(17):
|
||||
@@ -161,7 +162,8 @@ def graph_rows():
|
||||
w = W0 * 2 ** (-6 + j / 8.0)
|
||||
h4 = 1 / (1 + 1j * w) ** 4
|
||||
hx = 1 / (1 + 1j * w / WX)
|
||||
t = abs(h4 / (1 + min(k, KC * 0.985) * hx * h4)) * trim # (just below singing: a line has no infinite peak)
|
||||
out = (1j * w / (1 + 1j * w)) ** 4 if hp else h4
|
||||
t = abs(out / (1 + min(k, KC * 0.985) * hx * h4)) * trim # (just below singing: a line has no infinite peak)
|
||||
line.append(int(round(max(-50.0, min(30.0, 20 * math.log10(t + 1e-9))) * 8)))
|
||||
rows.append(line)
|
||||
return rows
|
||||
@@ -194,6 +196,11 @@ def emit(path):
|
||||
L.append(" {" + ", ".join(str(v) for v in line) + "},")
|
||||
L.append("};")
|
||||
L.append("")
|
||||
L.append("static const int16_t FMINI_GRAPH_HP[17][73] = { /* the same for FT_HP (the high-pass output), dB x 8 */")
|
||||
for line in graph_rows(hp=True):
|
||||
L.append(" {" + ", ".join(str(v) for v in line) + "},")
|
||||
L.append("};")
|
||||
L.append("")
|
||||
arr("FMINI_G", "uint32_t", G, 6, "/* stage pole G = g/(1+g), Q24, per semitone of the singing pitch */")
|
||||
arr("FMINI_GX", "uint32_t", GX, 6, "/* the feedback lag pole's G, Q24 */")
|
||||
pathlib.Path(path).write_text("\n".join(L))
|
||||
|
||||
@@ -1051,9 +1051,13 @@ the factory patch its SLOT names, as loading it does). rc: 0 ok,
|
||||
the patch the track's own (SLOT OWN, or the factory patch it equals unchanged), as an edit on the panel does, and does not
|
||||
write flash. The patch bytes: R1..R3 (0..2) range 0 LO .. 5 2'; W1..W3 (3..5) wave 0 TRI, SHARK, SAW, SQR, PLS W, PLS N;
|
||||
F2, F3 (6, 7) 64 = 0, +-7 semitones (the coarse law, 11 cents a step); L1..L3, LN (8..11) levels; SW1 (12) bits 1 OSC 1, 2 OSC 2, 4 OSC 3, 8 NOISE,
|
||||
16 PINK, 32 MOD OSC, 64 MOD FLT; SW2 (13) bits 1 GLIDE, 2 LFO SQR; TUNE (14) 64 = A 440; MMIX (15) MOD MIX; KBD (16);
|
||||
16 PINK, 32 MOD OSC, 64 MOD FLT; SW2 (13) bits 1 GLIDE, 2 LFO SQR, 4 HP (the high-pass output; 0 = LP, the default); TUNE (14) 64 = A 440; MMIX (15) MOD MIX; KBD (16);
|
||||
GLID (17) the kept glide time.
|
||||
|
||||
**FILT's LP / HP (2.x, the bit 4 of SW2):** the filter's output is the low-pass ladder (0, every patch so far) or the high-pass
|
||||
(1): (1 - LP)^4 of the same four stages, 24 dB/oct. The sanitiser keeps SW2 up to 7 (before it kept 3: a patch written with 4 had
|
||||
the bit cleared). The patch's CC for it is 72 (free); the settings record's layout is 0x51 (the controls grew by one).
|
||||
|
||||
**1.14.10 (DET FINE removed):** the fine law of 1.10 and 1.11 is gone. F2 and F3 are the coarse law again (64 = 0, 11 cents a step,
|
||||
+-7 semitones), with no switch. SW2 value 4 is no longer used: the sanitiser keeps SW2 up to 3 and clears that bit. While the GLIDE
|
||||
switch is on `P_GLIDE` (38) holds the same time (a `PUT` does not copy it: set both, as the page does).
|
||||
|
||||
Reference in new issue
Block a user