JIANT 0.6.2: SLICER STUT recordings shared (4 for six tracks)

GATE needs no memory and stays on all six tracks; STUT takes one of four
shared recordings at a step's start and gives it back when it leaves STUT;
a fifth STUT track plays live and the screen says STUT: 4 TRACKS MAX.
sl_buf back to 32 KB (the REPEAT loop's size): pool 318 KB of 336.
slicer_reset for the tests; new slot-sharing test; README changelog.

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-10-10 18:10:57 +00:00
1 parent 93c4b52d26
commit 6522453c28
8 files changed
+105 -17

No files matched your search

+9 -2
View File
@@ -15,13 +15,20 @@ and takes its song system from [SLOOP](https://github.com/isod89/sloop-fm1).
the FM-1, with sound, and is played with your computer keyboard or the mouse. The emulator, the installer and the
editor update themselves with every change merged into `main`.
> **Status: in development (v0.6.1).** It builds and passes every test (Felucca's and its own), but **it has not been
> **Status: in development (v0.6.2).** It builds and passes every test (Felucca's and its own), but **it has not been
> tested thoroughly on a real FM-1 yet**. Back up the flash before installing it.
## Changelog
Every update is listed here, newest first.
### v0.6.2
- **SLICER memory shared**: GATE works on all six tracks as before; **STUT** (the one that records and repeats) can
run on **up to 4 tracks at once**. A fifth STUT track plays live without repeats and the screen says
**STUT: 4 TRACKS MAX**; when one of the four leaves STUT, the waiting one takes its place on the next step. Each
track keeps its own pattern, rate and depth, and its sends still follow the chopped sound. This frees 16 KB of
the big-buffer memory (pool now at 92 %, 25 KB free) for future effects.
### v0.6.1
- **MIXER: the six tracks at once** in the JIANT style, as six thermal columns (number, sound, LEVEL as the heat
column with the meter over it, its dB, PAN and REV as two bars underneath). The other styles keep four cards that
@@ -241,7 +248,7 @@ macros and MIDI punch-ins), saved with KNOB 4 on the SONG page or on its own whe
- **ENV LOOP**: with the note held, the envelope goes back to the attack when it reaches sustain: an ADSR-shaped LFO.
### Effects and master
- **DIST** per track with TYPE (SOFT, HARD, FOLD, CRUSH, RECT) and TONE; **SLICER** per track.
- **DIST** per track with TYPE (SOFT, HARD, FOLD, CRUSH, RECT) and TONE; **SLICER** per track (STUT on up to 4 tracks at once).
- **Delay**: synced or free TIME (5 ms to 1.48 s), a single TONE, **grain delay** with PITCH and SPRAY (at long times
too), stereo WIDTH.
- **Reverb** with five models: ROOM, SPRING, **SHIMR** (shimmer, goes up an octave on every pass), **RESO** (four
+1 -1
View File
@@ -32,7 +32,7 @@
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
#endif
#ifndef FELUCCA_VERSION
#define FELUCCA_VERSION "v0.6.1" /* JIANT's (based on Felucca 1.1.5.1): the splash, the menu, the console, the editor */
#define FELUCCA_VERSION "v0.6.2" /* JIANT's (based on Felucca 1.1.5.1): the splash, the menu, the console, the editor */
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
+2 -2
View File
@@ -10,7 +10,7 @@
* REPEAT starts on the next 1/16 (at once while stopped); the filters at once; all end when let go, with a 2.9 ms
* ramp. Effects of different kinds stack; of the REPEATs the last pressed plays, and letting it go returns to the
* one held before.
* The buffer: the SLICER's recordings (sl_buf, its first 32 KB) borrowed as one stereo loop of 8192 frames at 22.05 kHz
* The buffer: the SLICER's recordings (sl_buf, 32 KB) borrowed as one stereo loop of 8192 frames at 22.05 kHz
* (371 ms). While borrowed, STUT tracks play live; their recordings are dropped afterwards. A REPEAT 1/8 longer
* than the loop at the tempo (below 81 BPM) does nothing (the map shows it dimmed).
* KNOB 1..4 with FX: the macros FILTER (the LPF / HPF), CRUSH, THROW (the dry mix into the delay and reverb
@@ -32,7 +32,7 @@ enum { PF_R8, PF_R16, PF_R32, PF_LPF, PF_HPF,
#define PF_MUTE (((1u << NTRK) - 1u) << PF_M1)
#define PF_MIDI (((1u << (PF_RND + 1)) - 1u) & ~((1u << PF_OCTD) - 1u)) /* PF_OCTD .. PF_RND: on the notes (pfx.c) */
#define PB_FRAMES 8192u /* stereo frames in sl_buf (a power of 2: the mask), 371 ms at 22.05 kHz */
_Static_assert(PB_FRAMES * 2u <= NTRK * SL_LEN && !(PB_FRAMES & (PB_FRAMES - 1u)), "the REPEAT loop in sl_buf");
_Static_assert(PB_FRAMES * 2u <= SL_SLOTS * SL_LEN && !(PB_FRAMES & (PB_FRAMES - 1u)), "the REPEAT loop in sl_buf");
#define PB_MAX (2u * PB_FRAMES) /* the longest loop, 44.1 kHz samples */
#define PF_TOP (63 << 8) /* filter cutoff index, Q8 (PF_SVF): the LPF's open end */
#define PF_LOW (14 << 8) /* .. the LPF sweep's end, the HPF sweep's (and K1's) top */
+37 -5
View File
@@ -9,7 +9,9 @@
* P_SLDEPTH GATE: how far a '.' step closes (100 % = silent); STUT: the level of the repeat
* GATE: the gain moves at most 1 / SL_RAMP per sample (2.9 ms from open to closed): a closing
* ramp ends on the step boundary, an opening one starts on it.
* STUT: an 'x' step plays live and is recorded (22.05 kHz, 16 bit, SL_LEN samples a track); a '.'
* STUT: an 'x' step plays live and is recorded (22.05 kHz, 16 bit, SL_LEN samples a track; JIANT 0.6: SL_SLOTS
* recordings shared by the six tracks, a STUT track takes a free one at a step's start and gives it back when it
* leaves STUT; a fifth STUT track plays live, records nothing, and the screen says so); a '.'
* step plays that recording from its start, looped at the step length (halved until it fits the
* recording), cross-faded with the live sound by DEPTH. Every pass of the loop is windowed
* (SL_RAMP at both ends and at the step end), the cross-fade moves as the gate does.
@@ -45,7 +47,10 @@ static const uint16_t SL_PAT[SL_NPAT] = {
};
static const uint8_t SL_DEN[6] = {2, 4, 8, 3, 6, 12}; /* P_SLRATE (N_SLDIV): a step = 1 / DEN beats */
static int16_t sl_buf[NTRK][SL_LEN] __attribute__((section(".pool")));
#define SL_SLOTS 4u /* (JIANT 0.6) STUT recordings at once (GATE needs none): 32 KB, as with four
* tracks; perform.c borrows all of them as the REPEAT loop */
#define SL_NONE 0xFFu
static int16_t sl_buf[SL_SLOTS][SL_LEN] __attribute__((section(".pool")));
typedef struct {
uint32_t pos, len; /* samples into the step, its length */
uint32_t base; /* the step without swing */
@@ -57,10 +62,18 @@ typedef struct {
uint8_t idx; /* step 0..15 */
uint8_t bit; /* this step's pattern bit (latched at its start) */
uint8_t rec_on; /* recording this step */
uint8_t slot; /* its sl_buf (STUT), SL_NONE: none */
} sl_t;
static sl_t sl[NTRK];
static sl_t sl[NTRK] = {[0 ... NTRK - 1] = {.slot = SL_NONE}};
static uint8_t sl_lent; /* perform.c has borrowed sl_buf: STUT plays live, records nothing */
static void slicer_reset(void) /* every track's clock and state cleared, no recording held (tests, power-on) */
{
uint32_t k;
memset(sl, 0, sizeof sl);
for (k = 0; k < NTRK; k++)
sl[k].slot = SL_NONE;
}
static void slicer_start(void) /* seq_start: the next block starts step 0 of every track */
{
uint32_t k;
@@ -108,7 +121,21 @@ static __attribute__((noinline)) void sl_enter(const track_t *t, sl_t *s, uint32
s->rp = 0;
s->loop = 0;
s->rec_on = 0;
if (mode != SL_STUT || sl_lent) {
if (mode != SL_STUT && s->slot != SL_NONE) {
s->slot = SL_NONE; /* (out of STUT: its recording back) */
} else if (mode == SL_STUT && s->slot == SL_NONE) {
uint32_t k, used = 0; /* a free recording, if any */
for (k = 0; k < NTRK; k++)
if (sl[k].slot != SL_NONE)
used |= 1u << sl[k].slot;
for (k = 0; k < SL_SLOTS && ((used >> k) & 1u); k++)
;
if (k < SL_SLOTS) {
s->slot = (uint8_t)k;
s->rec = 0;
}
}
if (mode != SL_STUT || sl_lent || s->slot == SL_NONE) {
s->rec = 0; /* nothing old to repeat when STUT comes on */
} else if (s->bit) {
s->rec = 0; /* a live step: record it */
@@ -182,12 +209,17 @@ static void slicer_track(const track_t *t, int32_t *b, uint32_t n)
if (m > n - i)
m = n - i;
if (act)
sl_seg(t, s, sl_buf[k], b + i, m);
sl_seg(t, s, sl_buf[s->slot < SL_SLOTS ? s->slot : 0u], b + i, m); /* (no slot: no recording, no repeat) */
s->pos += m;
i += m;
}
}
/* (JIANT 0.6) track t wants STUT but every recording is taken: it plays live (the screen says why) */
static int slicer_no_slot(const track_t *t)
{
return t->p[P_SLCR] == SL_STUT && sl[t - trk].slot == SL_NONE;
}
/* a silent part must still be rendered: a repeat is playing or fading (fx.c mix_part) */
static int slicer_busy(const track_t *t)
{
+11
View File
@@ -1146,6 +1146,17 @@ static void ui_input_frame(void)
int32_t s, sel = 0, ks[4] = {0, 0, 0, 0};
static uint32_t lock_ms; /* BPM LOCK: the last locked SELECT turn (fm1_ms | 1; 0 none) */
fm6_poll(); /* FM6: PTCH turned -> its patch */
{ /* (JIANT 0.6) the selected track asks for STUT with the four SLICER recordings taken: said once */
static uint8_t said; /* (a step boundary hands a free one out: 300 ms first) */
static uint32_t since;
uint32_t full = (uint32_t)slicer_no_slot(TSEL);
if (!full)
since = fm1_ms, said = 0;
else if (!said && fm1_ms - since > 300u) {
ui_message("STUT: 4 TRACKS MAX");
said = 1;
}
}
#if !FELUCCA_FM4
for (k = 0; k < NTRK; k++) /* a DIGITAL sound any other way (the paths convert it */
if (trk[k].eng_req == ENGI_DIGITAL) /* already): FM6 (fm4_convert.c) */
+1 -1
View File
@@ -55,7 +55,7 @@ static void perf_reset(void)
pfx_tgt = 0;
pfx_any = 0;
sl_lent = 0;
memset(sl, 0, sizeof sl);
slicer_reset();
}
/* the stage alone on the test signal: samples [t0, t1); ev: press (+e + 1) / let go (-(e + 1)) at block bt */
typedef struct { uint32_t t; int e; } ev_t;
+43 -5
View File
@@ -95,7 +95,7 @@ static int test_clicks(void)
int32_t in, out;
int64_t ce;
host_tracks_init();
memset(sl, 0, sizeof sl);
slicer_reset();
song.g[G_BPM] = (int16_t)C[c].bpm;
trk[0].p[P_SSWING] = (int16_t)C[c].swing;
set_slicer(&trk[0], C[c].mode, C[c].pat, C[c].rate, C[c].depth);
@@ -112,7 +112,7 @@ static int test_clicks(void)
int32_t in, out;
int64_t ce;
host_tracks_init();
memset(sl, 0, sizeof sl);
slicer_reset();
out = sine_run(10, 1, &in, &ce);
snprintf(what, sizeof what, "no clicks: mode / pattern / depth / rate turned while it runs: %d (%.1f x)", out,
(double)out / in);
@@ -131,7 +131,7 @@ static int test_timing(void)
char what[160];
track_t *t = &trk[0];
host_tracks_init();
memset(sl, 0, sizeof sl);
slicer_reset();
song.g[G_BPM] = 97;
song.g[G_SWING] = 10;
t->p[P_SSWING] = 20;
@@ -177,7 +177,7 @@ static void song_setup(void)
track_t *t1 = &trk[0], *t2 = &trk[1], *t3 = &trk[2], *td = &trk[3];
uint32_t i;
host_tracks_init();
memset(sl, 0, sizeof sl);
slicer_reset();
song.g[G_BPM] = 120;
host_preset(t1, 0, 4);
host_preset(t2, 1, 5);
@@ -272,7 +272,7 @@ static int test_off_stut(void)
track_t *t = &trk[0];
int bad = 0;
host_tracks_init();
memset(sl, 0, sizeof sl);
slicer_reset();
slicer_start();
for (f = 0; f < FS; f += CTL) { /* OFF: untouched */
int32_t b[CTL], c[CTL];
@@ -401,6 +401,43 @@ static void demos(const char *dir)
printf("slicer: demos in %s (song_dry / song_slicers, pad, acid, drums: dry and sliced)\n", dir);
}
/* (JIANT 0.6) four STUT recordings for the six tracks: the first four take one, the fifth plays live (no repeat),
* one leaving STUT gives its own back at its next step; GATE takes none */
static int test_slots(void)
{
uint32_t k, f, i, slots = 0, ok;
int bad = 0;
host_tracks_init();
slicer_reset();
slicer_start();
song.playing = 0;
for (k = 0; k < NTRK; k++)
set_slicer(&trk[k], k < 5u ? SL_STUT : SL_GATE, 7, 1, 127);
for (f = 0; f < FS / 2u; f += CTL)
for (k = 0; k < NTRK; k++) {
int32_t b[CTL];
for (i = 0; i < CTL; i++) b[i] = (int32_t)((f + i) * 37u % 2000u) - 1000;
slicer_track(&trk[k], b, CTL);
}
for (k = 0; k < NTRK; k++)
slots |= sl[k].slot < SL_SLOTS ? 1u << sl[k].slot : 0u;
ok = slots == 15u && sl[4].slot == SL_NONE && slicer_no_slot(&trk[4]) && !sl[4].loop && sl[5].slot == SL_NONE &&
!slicer_no_slot(&trk[5]);
for (k = 0; k < 4u; k++) ok &= sl[k].slot != SL_NONE;
bad += check("4 STUT recordings shared: tracks 1..4 hold one each, track 5 live (no repeat), GATE none", ok);
set_slicer(&trk[1], SL_OFF, 7, 1, 127);
for (f = 0; f < FS / 2u; f += CTL)
for (k = 0; k < NTRK; k++) {
int32_t b[CTL] = {0};
slicer_track(&trk[k], b, CTL);
}
bad += check(" track 2 leaves STUT: its recording goes to track 5 at its next step",
sl[1].slot == SL_NONE && sl[4].slot != SL_NONE && !slicer_no_slot(&trk[4]));
for (k = 0; k < NTRK; k++)
set_slicer(&trk[k], SL_OFF, 7, 1, 127);
return bad;
}
int main(int argc, char **argv)
{
int bad = 0;
@@ -408,6 +445,7 @@ int main(int argc, char **argv)
bad += test_timing();
bad += test_sync();
bad += test_off_stut();
bad += test_slots();
bad += test_cost();
if (argc > 1)
demos(argv[1]);
+1 -1
View File
@@ -127,7 +127,7 @@ static int test_slicer(void)
trk[k].p[P_SSWING] = (int16_t)(40 + 20 * k);
}
song.g[G_SWING] = 100;
memset(sl, 0, sizeof sl);
slicer_reset();
transport_req = 1;
for (f = 0; f < 8u * FS; f += CTL) {
int32_t o[2 * CTL];