MATH TIME (prototype): KEY / LOCK / TEMPO on MATH's MORE page by RESTART; LOCK the default

The owner: "que las fórmulas no cambien su time con las notas ... por defecto debería
estar así". MATH's t is already two clocks (MOTION's): the note's low 8 bits (the wave,
its pitch) and the slow bits above (the rhythm, the phrase). TIME picks the slow clock's
pace:
- KEY   the note's (as before: a key up, the formula faster). Every project and user
        preset of before reads KEY (its slot held 0), so they sound as they did.
- LOCK  C4's whatever the key: every key the same rhythm, transposed. At C4 KEY and LOCK
        are the same, bit for bit (the MOTION 64 shortcut kept where the paces are one).
        A factory preset load (ui.c apply_preset_to) sets it: the new default.
- TEMPO the song's clock (MOTION's own SYNC, 128 .. 255: t >> 13 a beat at MOTION 64),
        BYTE and FLOAT. WAVE SYNC (V10.8.62) stays as it was.
RESTART (KNOB 1) unchanged, combinable with any.

Where: core.h P_MTIME, in DRUM's IMAGE / VOICE's LYRIC slot (DIGITAL's OP3 REL: 0 on
every MATH track before it; a user preset and a project store it as any slot). MORE's
KNOB 2 (params.c PAGES, track_desc). lofi_render decides the slow clock once a block and
hands the renders its step in m->inc (0: the song's clock), so lofi_byte_render and
lofi_float_render each lose their own MOTION / WAVE SYNC tests (-4 B each).

Flash: TIME +108 B (code +76: lofi_render +68, apply_preset_to +12, track_desc +4, renders -8;
the descriptor and its names ~32), room 56 B: N_CHIP N_RWAVE N_MTIME packed into core.h (-24),
PNE (were tables of pointers), N_DIV = N_DTIME's first ten names (-32; PEN; enum_order tells
them apart by max; ui.c rate_name by str_nth; tests by N_DIV_N / desc_nm). Image 584336 B
of 584336 (0 B free; was 52). BT 73692 (unchanged), RAM .data+.bss 98120 (unchanged).
audio.c untouched; tools/audio_layout.txt recorded again (FELUCCA_REPIN=keep); a plain
build passes.

CPU (tests/cpu_lines_test.py, mean / worst %, the busier core): 101..108 and 0c the same
or 1 lower; 0d core 0 67 -> 68 / 71 -> 71 (+0.2 % instructions), 0e 82 / 85 unchanged;
0d / 0e with TIME KEY forced: the same as LOCK.

Tests: regress 219 golden renders, 0 changed (V23's intact); math_timelock_test rewritten
through lofi_render: WAVE SYNC as before, KEY faster up the octave, LOCK and TEMPO the
same slow time at C4 and C5 (BYTE, FLOAT), LOCK == KEY at C4, TEMPO follows the BPM, a
preset loads LOCK, a kit's IMAGE still 0; gen_test, fit_test, ui_test, app contract
(docs/NRPN.md, web/NRPN.md: 74 TIME on MATH) pass. The suite's other failures are the
same on 32099fee.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
This commit is contained in:
Claude committed 2026-11-30 19:06:21 +00:00
1 parent 32099fee4f
commit d9a4bba9ca
11 files changed
+2380 -2313

No files matched your search

+2 -1
View File
@@ -69,7 +69,8 @@ its own way the engines are named. P_E0..P_E7 (CC98 115..122) are the engine's E
| 71 | MORPH | 0..127 | 0 | |
| 72 | C.LEN | 0..64 | 0 | OFF 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ... |
| 73 | DRIFT | 0..127 | 127 | |
| 74 | IMAGE | 0..127 | 0 | (ANALOG PHASE MATH WHEEL STRING DRUM WEST FM6 ADD ANIMAL EXT) |
| 74 | IMAGE | 0..127 | 0 | (ANALOG PHASE WHEEL STRING DRUM WEST FM6 ADD ANIMAL EXT) |
| 74 | TIME | 0..2 | 1 | KEY LOCK TEMPO (MATH) |
| 74 | LYRIC | 0..25 | 0 | TEXT W1 W2 W3 W4 W5 W6 W7 W8 W9 W10 W11 W12 W13 W14 W15 W16 S1 S2 S3 S4 S5 S6 S7 S8 TEXT FIXED (VOICE) |
| 75 | DUST | 0..127 | 127 | |
| 76 | CHORD | 0..16 | 0 | OFF TRIAD 7TH ADD9 SUS2 SUS4 MAJ MIN 7 MAJ7 MIN7 POWER POP JAZZ SOUL DREAM QUART |
+10 -1
View File
@@ -122,6 +122,7 @@ static const char PNE[] =
/* N_PD_WAVE2 (eng_phase.c; N_PD_WAVE from its second) */ "-\0" "SAW\0" "SQR\0" "PLS\0" "DSIN\0" "SPLS\0" "RSAW\0" "RTRI\0" "RTRP\0"
/* N_ANALOG_WAVE (eng_analog.c) */ "SAW\0" "SQR\0" "TRI\0" "SIN\0" "PWM\0" "SYNC\0" "RING\0" "SAW3\0" "PLS3\0"
/* CLAY_RESN (clay_form.c; V10.8.74) */ "HOLD\0" "1/64\0" "1/32\0" "1/16\0" "1/8\0" "1/4\0" "1/2\0" "1BAR\0" "2BAR\0" "4BAR\0" "1/32D\0" "1/16D\0" "1/8D\0" "1/4D\0" "1/2D\0" "1/32T\0" "1/16T\0" "1/8T\0" "1/4T\0" "1/2T\0" "1/5\0" "1/10\0" "1/20\0" "1/7\0" "1/14\0" "1/28\0"
/* N_CHIP N_RWAVE (eng_lofi.c), N_MTIME (params.c; math-pitch: packed, was three tables of pointers) */ "4BIT\0" "4B/2\0" "8BIT\0" "1BIT\0" "-\0" "-\0" "-\0" "-\0" "-\0" "BYTE\0" "FLOAT\0" "SYNC\0" "KEY\0" "LOCK\0" "TEMPO\0"
/* N_ENGNAME (params.c; the last: its second name by the build) */ "ANALOG\0"
#if FELUCCA_FM4
"DIGITAL\0"
@@ -170,7 +171,10 @@ static const char PNE[] =
#define N_PD_WAVE ((const char *const *)(PNE + 1927))
#define N_ANALOG_WAVE ((const char *const *)(PNE + 1964))
#define CLAY_RESN ((const char *const *)(PNE + 2004))
#define N_ENGNAME ((const char *const *)(PNE + 2133))
#define N_CHIP ((const char *const *)(PNE + 2133))
#define N_RWAVE ((const char *const *)(PNE + 2153))
#define N_MTIME ((const char *const *)(PNE + 2179))
#define N_ENGNAME ((const char *const *)(PNE + 2194))
#define N_ENGNAME_N 16u
static inline uint32_t desc_fmt(const param_desc_t *d) { return d->fmt >= F_INT_CT ? (uint32_t)F_INT : d->fmt; }
static inline const char *desc_unit(const param_desc_t *d) /* F_INT_CT .. F_REG64's, else 0 */
@@ -272,6 +276,11 @@ enum { /* per-track parameters */
#define P_VLANG P_LRTRG
#define P_DKEYMODE P_LRTRG /* DRUM-X only: 0 classic, 1 extended performance octaves. */
#define P_VLYR P_DXIMG
/* (math-pitch, the owner: "que las fórmulas no cambien su time con las notas") MATH's TIME, on its MORE page by RESTART, in
* DRUM's IMAGE / VOICE's LYRIC slot (DIGITAL's OP3 REL: 0 on every MATH track before it): 0 KEY (the note's speed, the
* formula's rhythm with it: every project and user preset before it), 1 LOCK (the slow bits, its rhythm, at C4's pace
* whatever the key; the note its pitch: the factory default), 2 TEMPO (the slow bits the song's, WAVE SYNC's clock) */
#define P_MTIME P_DXIMG
/* (V10.6y, alex.knip) VOICE's CONS (EDIT > WORDS KNOB 3): its consonants' length, 50 .. 400 %, in DRUM-X's lane 2 level
* slot. 127 there (what every synth part holds) is 100 %, so a project or preset of before sings as it did: the knob's
* place (vcons_rank, params.c param_turn) is the value + 33, mod 128 (127 at 32: 50 .. 98 % left of it, 103 .. 400 %
+24 -10
View File
@@ -5,8 +5,8 @@
* NOIS WRAM, the STEP envelope) were redundant beside ANALOG (the user's call): a sound of theirs that arrives -- a
* project, a user preset -- plays as ANALOG's nearest (core.h analog_from_chip). The engine's number (3) and its stored
* values stay: WAVE 5 BYTE, 6 FLOAT; CHIP 0..3 the bits (STEP, 4, read as 4BIT: the same sound on BYTE and FLOAT) */
static const char *const N_CHIP[] = {"4BIT", "4B/2", "8BIT", "1BIT"};
static const char *const N_RWAVE[] = {"-", "-", "-", "-", "-", "BYTE", "FLOAT", "SYNC"}; /* (WAVE 5, 6: the stored numbers;
/* (math-pitch) N_CHIP, N_RWAVE: core.h PNE (packed, str_nth) */
/* N_RWAVE: "-" x 5, BYTE FLOAT SYNC (WAVE 5, 6: the stored numbers;
* V10.8.62 7: SYNC, BYTE with its time locked) */
enum { CHIP_4BIT, CHIP_4B2, CHIP_8BIT, CHIP_1BIT };
enum { RW_BYTE = 5, RW_FLOAT = 6, RW_BLOCK = 7 }; /* (V10.8.62) SYNC: BYTE, its rhythm locked to the tempo */
@@ -116,6 +116,15 @@ static const param_desc_t LOFI_FDCY = {"FEEDBK", F_PCT, 0, 127, 0, 0};
* sample (Q16) */
static volatile uint32_t beat_pos, beat_n;
static volatile uint32_t bar_n;
/* (math-pitch, the owner: "que las fórmulas no cambien su time con las notas") TIME (core.h P_MTIME, MORE's KNOB 2 by
* RESTART): KEY 0, LOCK 1, TEMPO 2. The renders' t is two clocks already (MOTION's): the note's low 8 bits (the wave, its
* pitch) and the slow bits above (the rhythm, the phrase), ts. KEY runs ts at the note's pace (a key up, the formula
* faster: every project and user preset before TIME); LOCK at C4's whatever the key (at C4 the two the same, bit for bit:
* the shortcut te = tt kept where the two paces are one); TEMPO on the song's clock (MOTION's SYNC, 128 .. 255, as it
* was: t >> 13 a beat at MOTION 64; WAVE SYNC keeps its own). lofi_render gives the renders ts's increment in m->inc
* (the note's, LOFI_C4 = pitch_inc(960) doubled at half the rate as the note's is, 0 for TEMPO) */
enum { MT_KEY, MT_LOCK, MT_TEMPO };
#define LOFI_C4 25480118u
static __attribute__((noinline)) uint32_t lofi_sync(uint32_t *rate)
{
uint32_t bl = (uint32_t)FS * 60u / (uint32_t)clamp(song.g[G_BPM], 20, 300);
@@ -260,7 +269,8 @@ static __attribute__((noinline)) void lofi_byte_render(track_t *t, voice_t *v, i
uint32_t vr = (uint32_t)clamp(p[P_E3] + ((m->shape - (64 << 8)) >> 8), 0, 127); /* (0.6.81) LFO / ENV ->
* SHAPE move VAR (SHAPE did nothing on BYTE) */
uint32_t f = (uint32_t)p[P_E2] >> 2, a = 1u + (vr >> 3), tt = (uint32_t)v->s[2], tf = v->ph[0], i;
uint32_t ti = (inc >> 8) * 31u; /* t a sample, Q24: C4 (inc ~2.55e7) ~0.18 = 8 kHz */
uint32_t ti = (inc >> 8) * 31u, si = (m->inc >> 8) * 31u; /* t a sample, Q24: C4 (inc ~2.55e7) ~0.18 = 8 kHz;
* (math-pitch) si the slow time's (TIME) */
uint32_t ft = ft_voice(p); /* (JIANT 0.5) the FILTER's type (COMB: open, voice.c combs) */
int32_t kd = 8192 - (p[P_FRES] > 50 ? p[P_FRES] : 50) * 7600 / 127; /* (0.5.4: the FILTER page's RES alone) */
uint32_t bs = p[P_E6] ? 13u - (uint32_t)p[P_E6] / 11u : 0u; /* BEND: the fold's shift, 13 .. 2 (0: none) */
@@ -268,7 +278,8 @@ static __attribute__((noinline)) void lofi_byte_render(track_t *t, voice_t *v, i
uint32_t lm = p[P_E7] ? (1u << (17u - (uint32_t)p[P_E7] * 12u / 127u)) - 1u : 0xFFFFFFFFu; /* LOOP: t's window */
uint32_t t0 = (uint32_t)(f < 32u ? BYTE_T0[f] : 0u) << 9; /* (0.5.1: the formula's start) */
uint32_t mul = lofi_motion(p[P_E4]), ts = v->ph[1], var = vr; /* (0.5.4) MOTN: the slow time, Q8 */
uint32_t lk = p[P_E1] == RW_BLOCK, sy = p[P_E4] >= 128 || lk, sr = 0, sb = sy ? lofi_sync(&sr) : 0u; /* (p6) SYNC;
uint32_t lk = p[P_E1] == RW_BLOCK, sy = !si, sr = 0, sb = sy ? lofi_sync(&sr) : 0u; /* (p6) SYNC (math-pitch:
* lofi_render's m->inc 0, as for TIME TEMPO);
* (V10.8.62, a user: "the bpm is not the same from a note to
* another") WAVE SYNC: the time locked, the slow bits (the rhythm) from
* the tempo (at 120 BPM as C4's own), the fast
@@ -310,7 +321,7 @@ static __attribute__((noinline)) void lofi_byte_render(track_t *t, voice_t *v, i
uint32_t te;
if (sy) /* (SYNC: the slow bits at the bar's position) */
ts = (sb + ((i * sr) >> 16)) * mul;
te = mul == 256u && !sy ? tt : (tt & 255u) | ((ts >> 8) & ~255u); /* (MOTN: the slow bits at their own
te = mul == 256u && si == ti ? tt : (tt & 255u) | ((ts >> 8) & ~255u); /* (MOTN: the slow bits at their own
* speed; 64: t as written) */
uint32_t tl = lofi_mut((te & lm) + t0, var), tw = bs ? tl ^ (tl >> bs) : tl; /* (VAR: mutated) */
int32_t s = (int32_t)(lofi_byte(f, tw, a) & 255u) * 256 - 32640;
@@ -323,7 +334,7 @@ static __attribute__((noinline)) void lofi_byte_render(track_t *t, voice_t *v, i
tt += tf >> 24;
tf &= 0xFFFFFFu;
if (!lk)
ts += ((ti >> 8) * mul) >> 16;
ts += ((si >> 8) * mul) >> 16;
l1 += (((held >> 1) - l1) * sk) >> 2; /* (JIANT 0.5) the 8-bit steps rounded: two one-poles before
* the filter (BYTE was knife-sharp); 0.9.11: at ~4.9 kHz, were
* ~6.3 (x 0.6): their images softer, the steps' edges filed */
@@ -348,8 +359,8 @@ static __attribute__((noinline)) void lofi_float_render(track_t *t, voice_t *v,
{
const int16_t *p = t->p;
uint32_t f = (uint32_t)p[P_E2] >> 2, tt = (uint32_t)v->s[2], tf = v->ph[0], ts = v->ph[1], i;
uint32_t ti = inc >> 3; /* (t a sample, Q24: 32 a cycle of the note) */
uint32_t sy = p[P_E4] >= 128, sr = 0, sb = sy ? lofi_sync(&sr) : 0u, vsh = VH_SH(); /* (p6) SYNC */
uint32_t ti = inc >> 3, si = m->inc >> 3; /* (t a sample, Q24: 32 a cycle of the note; si the slow time's) */
uint32_t sy = !si, sr = 0, sb = sy ? lofi_sync(&sr) : 0u, vsh = VH_SH(); /* (p6) SYNC, TIME TEMPO (lofi_render) */
uint32_t mul = lofi_motion(p[P_E4]), var = (uint32_t)clamp(p[P_E3] + ((m->shape - (64 << 8)) >> 8), 0, 127); /*
* (0.6.81: SHAPE moves VAR, as BYTE's) */
uint32_t fb2 = (uint32_t)p[P_E0] >> 2, mo = (uint32_t)clamp(p[P_E6], 0, 127); /* (V10.7.69, the owner) FLOAT: ALGO B
@@ -365,7 +376,7 @@ static __attribute__((noinline)) void lofi_float_render(track_t *t, voice_t *v,
int32_t s;
if (sy) /* (p6 SYNC: the slow bits at the bar's position) */
ts = (sb + ((i * sr) >> 16)) * mul;
te = mul == 256u && !sy ? tt : (tt & 255u) | ((ts >> 8) & ~255u);
te = mul == 256u && si == ti ? tt : (tt & 255u) | ((ts >> 8) & ~255u);
tl = lofi_mut(te & lm, var);
{ /* FBK: the last output moves t, up to +-16 t (half a turn of the sines, Q8): the formula modulates itself,
* FM-like; (V10.7.69) MORPH: A and B both only between the ends, B alone at the top */
@@ -382,7 +393,7 @@ static __attribute__((noinline)) void lofi_float_render(track_t *t, voice_t *v,
tf += ti;
tt += tf >> 24;
tf &= 0xFFFFFFu;
ts += ((ti >> 8) * mul) >> 16;
ts += ((si >> 8) * mul) >> 16;
sm = vsh ? sm + ((((s >> 1) - sm) * 55) >> 6) : LOFI_SOFT(s >> 1, sm); /* (V10.7.56: at half the rate the
* pole squared, 1 - (3/8)^2) */
out[i] += voice_amp(soft_knee(svf_mode(flt, sm, &y1, &y2, ft, kd), 16000) << 1, m, i);
@@ -443,6 +454,9 @@ static void lofi_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const
if (p[P_E2] < 0) /* (V10.8.75) USER: this core's voice for its formula */
mu_voice(t, v);
inc = pitch_inc(clamp(mg.pitch16, 0, 2047)); /* (the track's LFO in m->pitch16 already) */
mg.inc = p[P_E4] >= 128 || p[P_E1] == RW_BLOCK || p[P_MTIME] == MT_TEMPO ? 0u : /* (math-pitch) the slow time's
* step: 0 the song's clock (MOTION's SYNC, WAVE SYNC, TIME TEMPO), */
p[P_MTIME] == MT_LOCK ? LOFI_C4 << VH_SH() : inc; /* LOCK C4's, KEY the note's */
tsvf_coef(&flt, (p[P_FCUT] << 8) + mg.cutoff, rs); /* (JIANT 0.5: the FILTER page's CUT) */
if (p[P_E1] == RW_FLOAT) /* (JIANT 0.5.1) floatbeat */
lofi_float_render(t, v, out, n, &mg, inc, &flt);
+13 -7
View File
@@ -131,7 +131,9 @@ static const char N_LSYNC[] = "4BAR\0" "2BAR\0" "1BAR\0" "1/2\0" "1/4\0" "1/8D\0
"1/16T\0" "1/32\0" "8BAR\0" "16BAR"; /* (V10.27: -13 8BAR, -14 16BAR, a tester's; V10.8.71:
* packed, str_nth) */
/* (V10.8.72) N_AMODE: core.h PNE (packed, str_nth; append-only: seq.c AM_*, JIANT's AM_TRNS last) */
static const char *const N_DIV[] = {"1/4", "1/8", "1/16", "1/32", "8T", "16T", "1/2", "1/1", "2BAR", "4BAR"};
#define N_DIV N_DTIME /* (math-pitch: flash) the note divisions, N_DTIME's first ten
* (1/4 .. 4BAR; was a table of pointers of its own) */
#define N_DIV_N 10u
/* (JIANT 0.4) the delay's TIME: N_DIV's ten, then free times past the last division (5 ms .. 1.48 s, exponential;
* fx.c delay_samples, DTIME_MS); (0.8.4) appended up to the longest the line holds at a quarter rate (the values
* before them mean what they did) */
@@ -204,7 +206,7 @@ static const param_desc_t TP[P_COUNT] = {
[P_LD_SHP] = PD("SHAPE", F_BIPCT, -64, 63, 0),
[P_LD_AMP] = PD("AMP", F_PCT, 0, 127, 0),
[P_AMODE] = PEN("MODE", N_AMODE, 0),
[P_ARATE] = PE("RATE", N_DIV, 2),
[P_ARATE] = PEN("RATE", N_DIV, 2),
[P_AOCT] = PD("OCT", F_INT, 1, 4, 1),
[P_AGATE] = PD("GATE", F_PCT, 1, 127, 64),
[P_ASWING] = PD("SWING", F_PCT, 0, 100, 0),
@@ -216,7 +218,7 @@ static const param_desc_t TP[P_COUNT] = {
[P_QUANT] = PEN("QUANT", N_QUANT, 0),
[P_TRANS] = PD("TRANS", F_SEMI, -24, 24, 0),
[P_SLEN] = PD("LEN", F_STEPS, 1, NSTEP, 16),
[P_SDIV] = PE("DIV", N_DIV, 2),
[P_SDIV] = PEN("DIV", N_DIV, 2),
[P_SSWING] = PD("SWING", F_PCT, 0, 100, 0),
[P_SGATE] = PD("GATE", F_PCT, 1, 127, 127), /* (V10.6z4, the owner: 100 %, was 50 %; stored as before: param_store_def) */
[P_DIST] = PD("DIST", F_PCT, 0, 127, 0),
@@ -261,7 +263,7 @@ static const param_desc_t TP[P_COUNT] = {
* formulas RING STEPS XOR WOB SFOLD SAT */
[P_DTONE] = PD("TONE", F_BIPCT, -64, 63, 0), /* .. its tone: darker / brighter */
[P_MSLEN] = PD("LEN", F_STEPS, 1, 16, 16), /* (JIANT) the modulation sequence (mod.c MS_STEP) */
[P_MSDIV] = PE("DIV", N_DIV, 2),
[P_MSDIV] = PEN("DIV", N_DIV, 2),
[P_MSSLW] = PD("SLEW", F_PCT, 0, 127, 0),
#define MSTEP(k) [P_MS0 + (k)] = PD("LEVEL", F_PCT, 0, 127, 0)
MSTEP(0), MSTEP(1), MSTEP(2), MSTEP(3), MSTEP(4), MSTEP(5), MSTEP(6), MSTEP(7),
@@ -347,6 +349,7 @@ static const param_desc_t GP[G_COUNT] = {
};
static const param_desc_t LOFI_RTRG = {"RESTART", F_ONOFF, 0, 1, 1, 0}; /* (0.6.12) P_LRTRG on a MATH track (V10.6d: ON its default) */
static const param_desc_t LOFI_TIME = {"TIME", F_ENUM, 0, 2, 1, N_MTIME}; /* (math-pitch) MATH's P_MTIME (core.h) */
static const param_desc_t TRK_CHANCE = {"CHANCE", F_PCTINV, 0, 127, 0, 0}; /* (0.6.37) P_TCHAN: 0 = 100 % */
static const param_desc_t MORPH_DESC = {"MORPH", F_PCT, 0, 127, 0, 0}; /* (0.6.45) P_MORPH */
static const param_desc_t CLEN_DESC = {"C.LEN", F_ENUM, 0, 64, 0, N_CLEN}; /* (0.6.47) P_CLEN */
@@ -385,6 +388,8 @@ static const param_desc_t VLYR_DESC = {"LYRIC", F_ENUM, 0, LYR_N - 1, 0, N_LYRIC
static const param_desc_t VCONS_DESC = {"CONS", F_INT, 0, 127, 127, 0}; /* (V10.6y) P_VCONS: 127 = 100 % (core.h) */
static const param_desc_t *track_desc(const track_t *t, uint32_t id)
{
if (id == P_MTIME && ENGINES[eng_idx(t->eng_req)] == &ENG_LOFI) /* (math-pitch) MATH's TIME, in DRUM's IMAGE slot */
return &LOFI_TIME;
if (id == MOT_DJF) /* (0.9.1) a DJ FILTER record (motion.c): the global's */
return &GP[G_DJF];
if (id == P_SIMG && ENGINES[eng_idx(t->eng_req)] != &ENG_DRUM) /* (V10.49) a synth's STEREO IMAGE (codex/coherence:
@@ -520,8 +525,8 @@ static const uint8_t DTIME_ORDER[N_DTIME_N] = {9, 8, 7, 6, DT_DOT + 2u, 0, DT_DO
* then the free times, short to long */
static const uint8_t *enum_order(const param_desc_t *d)
{
return d->names == N_DIV ? DIV_ORDER : d->names == N_SLDIV ? SLDIV_ORDER : d->names == N_DTIME ? DTIME_ORDER :
0;
return d->names == N_DTIME ? (d->max < (int16_t)N_DIV_N ? DIV_ORDER : DTIME_ORDER) : d->names == N_SLDIV ? SLDIV_ORDER :
0; /* (N_DIV: N_DTIME's first ten, its max 9) */
}
static int32_t enum_rank(const param_desc_t *d, int32_t v) /* v's place in the shown order (+ min): the gauges */
{
@@ -907,7 +912,8 @@ static const page_t PAGES[] = {
/* (V10.7.60, the owner: fewer pages) MORE, the voices' last page: an engine's few extras (MATH BYTE's RESTART; ANALOG
* and PHASE's MORPH DRIFT; WHEEL's ROTOR DEPTH DUST) with UNISON and VEL; one MORE an engine (page_visible). ALLOC
* and NOTE PRIO off the panel (kept: the editor, NRPN, the projects) */
{"MORE", FAM_EDIT, SC_TRACK, GR_NONE, {P_LRTRG, 0xFF, 0xFF, 0xFF}}, /* (V10.7.64: UNISON VEL on PLAY) */
{"MORE", FAM_EDIT, SC_TRACK, GR_NONE, {P_LRTRG, P_MTIME, 0xFF, 0xFF}}, /* (V10.7.64: UNISON VEL on PLAY; math-pitch:
* MATH's TIME by RESTART) */
{"MORE", FAM_EDIT, SC_TRACK, GR_MORPH, {P_MORPH, P_DRIFT, 0xFF, 0xFF}}, /* (V10.8.44: GAIN on LEVEL) */ /* (V10.7.64: ANALOG's GAIN, its DRIVE off the panel) */ /* (0.6.45) the wave morphs;
* (0.7.8) DRIFT: the voices wander */
{"MORE", FAM_EDIT, SC_TRACK, GR_NONE, {P_WRDEP, P_WDUST, 0xFF, 0xFF}}, /* (0.7.8) WHEEL: the rotor's depth, DUST */
+5 -2
View File
@@ -967,7 +967,7 @@ static void rate_name(const track_t *t, uint32_t n, char *b)
static const uint8_t BASE[10] = {4, 8, 16, 32, 0, 0, 2, 1, 0, 0}; /* N_DIV: 1/4 1/8 1/16 1/32 8T 16T 1/2 1/1 2BAR 4BAR */
uint32_t d = (uint32_t)clamp(t->p[P_SDIV], 0, 9), base = BASE[d], v = 0;
const char *tr = "";
if (n == 1u && (d == 4u || d == 5u)) { str_cpy(b, N_DIV[d], 8); return; } /* (8T 16T; a bar DIV x1) */
if (n == 1u && (d == 4u || d == 5u)) { str_cpy(b, str_nth((const char *)N_DIV, d), 8); return; } /* (8T 16T; a bar DIV x1) */
if (base && (n == 1u || n == 2u || n == 4u || n == 8u)) v = base * n;
else if (base && (n == 3u || n == 6u)) { v = base * n * 2u / 3u; tr = "T"; }
if (!v || v > 64u) { b[0] = 'x'; fmt_int(b + 1, (int32_t)n); return; } /* (past 1/64: "x6") */
@@ -1642,8 +1642,11 @@ static void apply_preset_to(track_t *t, uint32_t pi)
t->p[P_VOICE] = PR_MONO(&e->presets[pi]) ? V_LEGATO : V_POLY; /* mono presets keep the legato feel */
if (PR_TAG(&e->presets[pi]) == PT_BASS) /* (VEL, the owner: a bass is better even) a bass's VEL 0 %: */
t->p[P_TVEL] = 0; /* every note at 100, its ACCENTs still 127 */
if (e == &ENG_LOFI || e == &ENG_DRUM) /* (V10.6d) MATH: RTRG on, each note the formula from its start */
if (e == &ENG_LOFI || e == &ENG_DRUM) { /* (V10.6d) MATH: RTRG on, each note the formula from its start; */
t->p[P_LRTRG] = e == &ENG_DRUM ? km : 1;
t->p[P_MTIME] = e == &ENG_LOFI; /* (math-pitch) TIME LOCK (MT_LOCK): the note its pitch, not its
* rhythm (DRUM's IMAGE: 0, as the loop above left it) */
}
if (e == &ENG_FORMANT) { /* (0.8.5) VOICE's words: LANG, LYRIC (0: its vowels) */
t->p[P_VLANG] = (int16_t)(e->presets[pi].xp & 3u);
t->p[P_VLYR] = (int16_t)(e->presets[pi].xp >> 2);
+1 -1
View File
@@ -16,7 +16,7 @@ int main(void)
song.g[G_SWING] = 0;
for (uint32_t b = 0; b < NELEM(tempos); b++) {
song.g[G_BPM] = tempos[b];
for (uint32_t div = 0; div < NELEM(N_DIV); div++) {
for (uint32_t div = 0; div < N_DIV_N; div++) {
uint32_t period = div_samples(div);
for (uint32_t len = 1; len <= NSTEP; len++) {
t->p[P_SLEN] = len;
+62 -27
View File
@@ -1,34 +1,39 @@
// Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant). All rights reserved.
/* (V10.8.62, a user: "I love the MATH BYTEBEAT's sound and its kinda arp, but the bpm is not the same from a note to
* another") MATH's WAVE SYNC (the time locked): BYTE's slow bits (its rhythm, the arp's steps) from the tempo, the fast
* ones (the pitch) the note's. Two notes an octave apart at 120 BPM: the same rhythm (the slow time and the windows the
* pattern steps in, block by block), different pitches; WAVE BYTE as before: the rhythm the note's (an octave up, twice
* as fast). Built and run by CI (voice-user-check.yml) */
* ones (the pitch) the note's. (math-pitch, the owner: "que las fórmulas no cambien su time con las notas") and MATH's
* TIME (core.h P_MTIME, MORE's KNOB 2): KEY the note's pace (as before), LOCK C4's whatever the key, TEMPO the song's.
* Two notes an octave apart at 120 BPM, through lofi_render (the voice's own set-up: TIME decided there):
* WAVE SYNC, TIME LOCK, TIME TEMPO (BYTE and FLOAT): the same slow time block by block, the same rhythm; two pitches
* TIME KEY: the octave runs the rhythm faster (as before); at C4 KEY and LOCK the same, bit for bit
* TEMPO follows the BPM (60 BPM: half the steps of 120); a MATH preset loads TIME LOCK, a store of before reads KEY
* Built and run by CI (voice-user-check.yml) */
#define UI_TEST_NO_MAIN 1
#include "ui_test.c"
#define TL_BLOCKS 6000u /* (~8.7 s: ~17 beats at 120) */
/* BYTEBEAT's formula (ALGO 4: B01), WAVE w, at note n for TL_BLOCKS blocks, the bar's clock run by the test at 120 BPM:
* each block's slow time (v.ph[1]) into ts[], the steps of the rhythm (the slow bits' changes) counted; the output's hash */
static uint32_t take(int16_t w, uint32_t n, uint32_t *ts, uint32_t *steps)
/* formula ALGO 4 (B02, BYTE) or 8 (F03, FLOAT), WAVE w, TIME tm, MOTION mo, at note n for TL_BLOCKS blocks, the bar's
* clock run by the test at bpm: each block's slow time (v.ph[1]) into ts[], the steps of the rhythm (the slow bits'
* changes) counted; the output's hash */
static uint32_t take(int16_t w, int16_t tm, int16_t mo, uint32_t n, uint32_t bpm, uint32_t *ts, uint32_t *steps)
{
static track_t t;
static voice_t v;
static int32_t o[CTL];
vmod_t m;
tsvf_t flt;
uint32_t k, i, h = 2166136261u, last = 0xFFFFFFFFu;
memset(&t, 0, sizeof t); memset(&v, 0, sizeof v); memset(&m, 0, sizeof m);
t.p[P_E0] = 2; t.p[P_E1] = w; t.p[P_E2] = 4; t.p[P_FCUT] = 127; t.p[P_FRES] = 50;
m.amp0 = m.amp1 = 32767; m.shape = 64 << 8;
tsvf_coef(&flt, 127 << 8, 50);
song.g[G_BPM] = 120;
memset(&t, 0, sizeof t); memset(&v, 0, sizeof v);
t.p[P_E0] = 2; t.p[P_E1] = w; t.p[P_E2] = w == RW_FLOAT ? 8 : 4; t.p[P_E4] = mo; t.p[P_FCUT] = 127; t.p[P_FRES] = 50;
t.p[P_MTIME] = tm;
song.g[G_BPM] = (int16_t)bpm;
bar_n = 0; beat_n = 0; beat_pos = 0;
lofi_note_on(&t, &v);
*steps = 0;
for (k = 0; k < TL_BLOCKS; k++) {
vmod_t m;
memset(&m, 0, sizeof m);
m.amp0 = m.amp1 = 32767; m.shape = 64 << 8; m.pitch16 = (int32_t)n * 16;
memset(o, 0, sizeof o);
lofi_byte_render(&t, &v, o, CTL, &m, pitch_inc((int32_t)n << 4), 1, 8, &flt);
lofi_render(&t, &v, o, CTL, &m);
for (i = 0; i < CTL; i++) h = (h ^ (uint32_t)o[i]) * 16777619u;
ts[k] = v.ph[1];
if ((ts[k] >> 16) != last) { last = ts[k] >> 16; (*steps)++; }
@@ -41,23 +46,53 @@ static uint32_t take(int16_t w, uint32_t n, uint32_t *ts, uint32_t *steps)
}
return h;
}
static uint32_t a[TL_BLOCKS], b[TL_BLOCKS];
/* C4 and C5 the same slow time, block by block; *ha / *hb their outputs' hashes, *sa / *sb their steps */
static uint32_t pair(int16_t w, int16_t tm, int16_t mo, uint32_t *ha, uint32_t *hb, uint32_t *sa, uint32_t *sb)
{
uint32_t k, same = 1;
*ha = take(w, tm, mo, 60, 120, a, sa);
*hb = take(w, tm, mo, 72, 120, b, sb);
for (k = 0; k < TL_BLOCKS; k++)
same &= a[k] == b[k];
return same;
}
int main(void)
{
static uint32_t a[TL_BLOCKS], b[TL_BLOCKS], c[TL_BLOCKS], d[TL_BLOCKS];
uint32_t sa, sb, sc, sd, k, same = 1, differ = 0;
uint32_t ha = take(RW_BLOCK, 60, a, &sa), hb = take(RW_BLOCK, 72, b, &sb);
uint32_t hc = take(RW_BYTE, 60, c, &sc), hd = take(RW_BYTE, 72, d, &sd);
uint32_t ha, hb, sa, sb, hk, hl, s60, s120;
int bad = 0;
for (k = 0; k < TL_BLOCKS; k++) {
same &= a[k] == b[k];
differ |= c[k] != d[k];
bad += check("WAVE SYNC at 120 BPM: C4 and C5 the same slow time, block by block (the same rhythm)",
pair(RW_BLOCK, MT_KEY, 0, &ha, &hb, &sa, &sb) && sa == sb && sa > 4u);
bad += check("WAVE SYNC: the notes still two pitches (different output)", ha != hb);
printf("math-timelock: WAVE SYNC steps %u / %u\n", sa, sb);
pair(RW_BYTE, MT_KEY, 0, &hk, &hb, &sa, &sb);
bad += check("TIME KEY (BYTE): the octave runs the rhythm faster (as before)", sb > sa);
printf("math-timelock: KEY steps %u / %u\n", sa, sb);
bad += check("TIME LOCK (BYTE, MOTION 0): C4 and C5 the same slow time, two pitches",
pair(RW_BYTE, MT_LOCK, 0, &hl, &hb, &sa, &sb) && sa == sb && sa > 4u && hl != hb);
bad += check("TIME LOCK at C4 is KEY at C4, bit for bit", hl == hk);
bad += check("TIME LOCK (BYTE, MOTION 64: t as written, no shortcut): the same slow time",
pair(RW_BYTE, MT_LOCK, 64, &ha, &hb, &sa, &sb) && ha != hb);
bad += check("TIME LOCK (FLOAT): the same slow time, two pitches",
pair(RW_FLOAT, MT_LOCK, 64, &ha, &hb, &sa, &sb) && ha != hb);
take(RW_FLOAT, MT_KEY, 64, 60, 120, a, &sa);
take(RW_FLOAT, MT_KEY, 64, 72, 120, b, &sb);
bad += check("TIME KEY (FLOAT): the octave faster (as before)", sb > sa);
bad += check("TIME TEMPO (BYTE, FLOAT): the same slow time at C4 and C5",
pair(RW_BYTE, MT_TEMPO, 0, &ha, &hb, &sa, &sb) && ha != hb && pair(RW_FLOAT, MT_TEMPO, 0, &ha, &hb, &sa, &sb));
take(RW_BYTE, MT_TEMPO, 64, 60, 120, a, &s120);
take(RW_BYTE, MT_TEMPO, 64, 60, 60, a, &s60);
bad += check("TIME TEMPO follows the BPM (60 BPM about half the steps of 120)", s60 * 2u <= s120 + 2u && s60 * 2u + 2u >= s120);
printf("math-timelock: TEMPO steps at 120 / 60 BPM: %u / %u\n", s120, s60);
{
track_t *t = &trk[0];
set_engine_of(t, ENGI_LOFI);
bad += check("a MATH preset loads TIME LOCK, RESTART on", t->p[P_MTIME] == MT_LOCK && t->p[P_LRTRG] == 1);
bad += check("MORE's KNOB 2 on MATH: TIME (KEY LOCK TEMPO)", track_desc(t, P_MTIME)->max == 2 &&
str_eq(desc_nm(track_desc(t, P_MTIME), 0), "KEY") && str_eq(desc_nm(track_desc(t, P_MTIME), 2), "TEMPO"));
set_engine_of(t, ENGI_DRUM);
bad += check("a DRUM kit's IMAGE (the same slot) still 0 after a load", t->p[P_DXIMG] == 0);
}
bad += check("SYNC at 120 BPM: C4 and C5 the same slow time, block by block (the same rhythm)", same);
bad += check("SYNC: the rhythm steps as many times for both notes", sa == sb && sa > 4u);
bad += check("SYNC: the notes still two pitches (different output)", ha != hb);
bad += check("BYTE (no lock): the octave runs the rhythm faster (as before)", differ && sd > sc);
bad += check("SYNC and BYTE: different time bases at C4", ha != hc);
printf("math-timelock: SYNC steps %u / %u, BYTE %u / %u\n", sa, sb, sc, sd);
printf(bad ? "math-timelock: %d FAILED\n" : "math-timelock: all ok\n", bad);
return bad != 0;
}
+1 -1
View File
@@ -9808,7 +9808,7 @@ static int test_div_order(void)
song.g[G_DTIME] = 1;
bad += check("delay TIME: past 1/32 the free times 5 ms .. 1.48 s and on to the line's longest, each longer; the delay that long", okf);
}
ok &= str_eq(N_DIV[2], "1/16") && str_eq(N_DIV[4], "8T") && str_eq(N_DIV[9], "4BAR") && TP[P_SDIV].def == 2;
ok &= str_eq(desc_nm(&TP[P_SDIV], 2), "1/16") && str_eq(desc_nm(&TP[P_SDIV], 4), "8T") && str_eq(desc_nm(&TP[P_SDIV], 9), "4BAR") && TP[P_SDIV].def == 2;
ok &= param_turn(&TP[P_SDIV], 2, 1) == 5 && param_turn(&TP[P_SDIV], 2, -1) == 4 && /* 1/16: right 16T, left 8T */
param_turn(&TP[P_SDIV], 3, 1) == 3 && param_turn(&TP[P_SDIV], 9, -1) == 9 && /* the ends hold */
param_turn(&TP[P_SDIV], 2, -6) == 8 && param_turn(&TP[P_SDIV], 2, 40) == 3; /* 6 left: 2BAR; far: clamped */
+2246 -2248
View File
File diff suppressed because it is too large. Load diff
+14 -14
View File
@@ -34,7 +34,7 @@ animal_init 136 text
animal_note_on 32 text * an_mode
animal_render 3806 text * an_exp2n an_inc
apply_preset 72 text apply_preset_to drum_elsewhere trk_eng tsel_p ui_message
apply_preset_to 526 text eng_gone fm6_adopt fm6_load_slot load_begin param_kept trk_eng trk_engp tsel_p
apply_preset_to 538 text eng_gone fm6_adopt fm6_load_slot load_begin param_kept trk_eng trk_engp tsel_p
arp_chord 188 text rec_note rec_on seq_note_on tvel
arp_chord_off 50 text rec_release seq_note_off
arp_off 68 text arp_chord_off rec_on rec_release seq_note_off
@@ -169,7 +169,7 @@ cm_one 894 text
comp_any 22 text
comp_arg 20 text comp_slot
comp_col 60 text
comp_columns 1594 text comp_arg comp_slot comp_view empty_column fmt_int hot_unit_column motion_lock_at str_cat str_cpy str_len str_nth text_column tsel_p unit_column val_col
comp_columns 1602 text comp_arg comp_slot comp_view empty_column fmt_int hot_unit_column motion_lock_at str_cat str_cpy str_len str_nth text_column tsel_p unit_column val_col
comp_knob 1022 text chain_busy comp_slot comp_view cond_at cond_idx motion_lock_at tsel_p ui_message
comp_legacy 26 text
comp_migrate 298 text cm_one
@@ -403,7 +403,7 @@ eng_vis 24 text
eng_voice_weight 48 text
ent_commit 456 text cursor_set memset rng tsel_p
ent_message 210 text fmt_cat str_cat str_cpy str_nth
enum_order 56 text
enum_order 54 text
enum_rank 94 text enum_order
enum_skip 32 text fm6_slot_ok
ep4_fill 622 text sie_wr uac_squeeze
@@ -859,7 +859,7 @@ kc_w 22 text
kern 78 text glyph_at
key_black 28 text
key_next 336 text drum_oct_note dxo_on midi_local_held mo_key mo_kon
key_off 278 text drum_oct_note dxo_off input_off midi_local_held mo_koff rec_release trk_note_off
key_off 278 text * drum_oct_note dxo_off input_off midi_local_held mo_koff rec_release trk_note_off
key_place 46 text key_black
keys_mode 32 text ckeys_on grid_on name_on skeys_on
keys_pg 56 text cur_page
@@ -945,13 +945,13 @@ lock_held 198 text cur_page grid_on key_black key_place live_rec_sel name_on tse
lock_id 84 text lock_page_ok motion_param trk_engp tsel_p
lock_page_ok 68 text motion_param
lofi_byte 1408 text
lofi_byte_render 1260 text lofi_byte lofi_mut lofi_sync
lofi_byte_render 1256 text lofi_byte lofi_mut lofi_sync
lofi_desc 174 text *
lofi_float 1842 text mul64_sh15 sine_i
lofi_float_render 964 text lofi_float lofi_mut lofi_sync
lofi_float_render 960 text lofi_float lofi_mut lofi_sync
lofi_mut 126 text
lofi_note_on 40 text *
lofi_render 324 text * lofi_byte_render lofi_float_render memcpy mu_voice
lofi_render 392 text * lofi_byte_render lofi_float_render memcpy mu_voice
lofi_sync 84 text
lowest_held 80 text
lv_neutral 44 text
@@ -1215,7 +1215,7 @@ ott_defaults 20 text ott_put
ott_get 56 text
ott_lin 44 text
ott_log2 38 text
ott_put 80 text *
ott_put 80 text
page_big 92 text cv_text face_has text_w
page_desc 2432 text eu_of page_desc_v str_cpy str_len str_nth track_desc tsel_p
page_desc_v 298 text
@@ -1241,7 +1241,7 @@ param_fit 58 text
param_format 834 text desc_nm desc_unit fmt_fix fmt_int name_of str_cpy str_nth vcons_q6
param_kept 52 text
param_store_def 18 text param_desc_of
param_turn 370 text enum_order enum_rank enum_skip name_of
param_turn 372 text enum_order enum_rank enum_skip name_of
params_by_count 58 text
part_dice 754 text apply_preset_to chain_busy confirm_open dice_by dk_vis_take drum_elsewhere rng semi_pick track_desc trk_eng tsel_p undo_mark
pb_loop 228 text
@@ -1273,7 +1273,7 @@ perf_rtp 648 text pb_ring_f perf_str
perf_slot 26 text key_black key_place
perf_str 402 text pb_loop
perf_switch 194 text perf_len
perf_unhush 72 text *
perf_unhush 72 text
pf_column 56 text draw_column param_format ratio_d
pfx_block 1412 text beat_samples div_samples memset pfx_fire pfx_hush pfx_lane_at pfx_lane_put pfx_rec_ok
pfx_end 142 text
@@ -1442,10 +1442,10 @@ sc_track 334 text input_on midi_local_held mo_key mo_kon rec_note rec_on scn_not
scale_mask 32 text
scale_snap 52 text scale_mask
scale_steps 112 text scale_mask scale_snap
scene_drum_tick 272 text div_samples trk_note_off trk_note_on
scene_drum_tick 272 text * div_samples trk_note_off trk_note_on
scene_follow 156 text sc_track scene_follow_off
scene_follow_off 82 text input_off mo_koff
scene_key 322 text input_off kb_map midi_local_held mo_koff sc_track
scene_follow_off 82 text * input_off mo_koff
scene_key 322 text * input_off kb_map midi_local_held mo_koff sc_track
scn_notes 280 text chord_build_mode
scope_at 238 text cv_rect scope_lod scope_seg
scope_lod 110 text scope_seg
@@ -1682,7 +1682,7 @@ track_col6 1238 text cur_page cv_begin cv_blit cv_pset cv_rect cv_rrect cv_text
track_comb 662 text pitch_inc soft_knee
track_defaults 26 text
track_defaults_steps 114 text chain_busy motion_reset step_clear
track_desc 226 text !
track_desc 230 text !
track_dist 816 hot_text ! dist_amp dist_shape
track_filter 478 text tf_run
track_follow_peak 310 text *
+2 -1
View File
@@ -69,7 +69,8 @@ its own way the engines are named. P_E0..P_E7 (CC98 115..122) are the engine's E
| 71 | MORPH | 0..127 | 0 | |
| 72 | C.LEN | 0..64 | 0 | OFF 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ... |
| 73 | DRIFT | 0..127 | 127 | |
| 74 | IMAGE | 0..127 | 0 | (ANALOG PHASE MATH WHEEL STRING DRUM WEST FM6 ADD ANIMAL EXT) |
| 74 | IMAGE | 0..127 | 0 | (ANALOG PHASE WHEEL STRING DRUM WEST FM6 ADD ANIMAL EXT) |
| 74 | TIME | 0..2 | 1 | KEY LOCK TEMPO (MATH) |
| 74 | LYRIC | 0..25 | 0 | TEXT W1 W2 W3 W4 W5 W6 W7 W8 W9 W10 W11 W12 W13 W14 W15 W16 S1 S2 S3 S4 S5 S6 S7 S8 TEXT FIXED (VOICE) |
| 75 | DUST | 0..127 | 127 | |
| 76 | CHORD | 0..16 | 0 | OFF TRIAD 7TH ADD9 SUS2 SUS4 MAJ MIN 7 MAJ7 MIN7 POWER POP JAZZ SOUL DREAM QUART |