V10.8.34: the song generator (the owner: "interesting but half comic"; more progressions, melodies, call and response, different parts, personality): twelve more progressions, two a harmony family (PROGF: i iv i v, the minor cycle of fourths, I V vi IV, I bVII IV I, i VI III V, jazz's turnarounds back to ii), a throw in four; the contrast section its own progression (the family's grammar, A's qualities), a section's register its own (PARTS: B a third down, C a fourth up); the lead's motif with a signature leap (a fifth or a sixth, the seed's place), four more syncopated cells, a sixth operator (DISPL: an eighth late), call and response a throw in four more, its answers above the call; a dialogue (a throw in two: the arp silent where the lead speaks, answering in its gaps); no BEND thrown onto the lead, no CLIMB onto the arp; MY LOOP, the latin genres, MINIMAL TECHNO, EBM, EXPLORE, the drums, the bass, the sounds and the mix as they were. tests/gen_study.c, gen_audit.c, gen_stems.c: the pieces measured (docs/GENERATOR-STUDY.es.md on main)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
This commit is contained in:
Claude committed 2026-11-24 14:27:54 +00:00
1 parent 0f6d4f6dd0
commit 00f6801100
6 files changed
+290 -17

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
#endif
#ifndef FELUCCA_VERSION
#define FELUCCA_VERSION "V10.8.33" /* (2026-11-23) V10.8.21: SEQ > CLAY (the owner): DRONE CLAY, JIANT BYTE's drone and its four modulators (DEST SHAPE EUCLID AMOUNT; DECAY, STEP, SEED) on any track, kept with the project ('C' 'Y'), its pages' picture the modulators' telemetry. V10.7.77: GEN (the owner): DUBSTEP's wobble its rate moving (the wobble bass's LFO RATE automated half a bar each: 1/4 1/8 1/8T 1/16); CUMBIA villera one throw in two (a villera 'teclado': 92 .. 100, minor, the keyboard's lead up front). V10.7.76: DRUM-X MATH a wavetable (the owner: "harsh"): its t whole cycles of the hit's time (one shape evolving), interpolated between its samples; SOUND 3 draws it (four moments, cold to hot); hints trimmed (flash). V10.7.75: DRUM-X MATH (the owner): its RATIO (1/4 .. 16, 24, the inharmonic between) on SOUND 3's KNOB 4, COLOR read MOD AMT; MATH's RESTART the scope (its ramps' picture gone), ten more hints out (flash). V10.7.74: DRUM-X MATH (the owner): a sound's WAVE past BELL a MATH formula F01..F48 as its FM's modulator (COLOR its index; its t the hit's time, a sample in eight), kept with the project ('D' 'F'). V10.7.73: SCL > HARMONY its own tab (KEY CHORD HARMONY SCENE); the defaults once (the owner): LARGE off, CLICK REC, COUNT-IN 1 BAR. V10.7.72: GEN (the owner): MATH WEST STRING more (the archetypes' third options theirs, 25 %; a bass's one time in ten); GLO > GLOBAL the scope, its bars gone. V10.7.71: SCL > HARMONY's picture (the owner): the progression's chords as roman numerals in the key ("-" minor, "o" diminished), each its root's colour, the one playing lit; the obvious knobs' hints out (flash). V10.7.70: FX > PUNCH IN: KNOB 4 M4 (its ERASE PUNCH LANE's only), so OCT+ always the punch-in editor (an ERASE picked took it). V10.7.69: MATH FLOAT MORPH (the owner): ALGO B where CHIP was, MORPH A -> B where BEND was (between the ends B a sample in eight, interpolated: +12.5 % CPU); MATH's formulas (lofi_float, lofi_byte) their 14 divisions by a constant as multiplies (JIANT BYTE 0.16's build pass, tools/build.py const_divs: exact, less CPU a sample); the MACRO layer's dead branches out (flash). V10.7.68: EUCLID MODES > ROLE (MELODY CHORDS BASS ARP, was CHORD) on the harmony the other melodic tracks play, bar by bar (four bars when it changes), else SCL's key; a recorded melody EUCLID takes: its notes as they were; LFO / FX dice leftovers out (flash). V10.7.67: GEN and EUCLID MUTATE fuse two seeds (the owner: never one as it is; the second far from the first), A+B in the name; FX + OCT+ opens the punch-in editor again (as OCT+ on FX > PUNCH IN). V10.7.66: SCL > HARMONY (PROG LENGTH EVOLVE SKIP: every melodic sequence follows a progression); GEN 8 progressions more (neo-soul, jazz, IDM, progressive); EUCLID's melody CONTOUR RANGE MOTIF CHORD; macros FX > PUNCH IN's only (LFO's layer, HOME > ROUTES gone, MACROS in FX), GLO's layer says G4 UNDO; the PUNCH-IN EDITOR redone (the owner): a key WHAT (an effect, or PARAM: M1..M4, CUT PITCH TIMBRE VOLUME PAN DIST CHORUS DELAY REVERB VIBRATO on every track), HOW (an effect HOLD LATCH QUANT; PARAM HOLD RAMP UP RAMP DN SINE STUTTER S&H), AMOUNT (-100..+100 %; an effect its TARGET), TIME (1/16 .. 8 BARS); two slots A B; FX > PUNCH IN its knobs M1..M4 (PUNCH LANE: LEN RES); the layers MAP only (KNOBS STATE gone, ALGORITHM nothing held), the FX cards "M1 CUT"; FX + SELECT the FX pages (its dice gone). GENE while it plays waits for the bar to end (Hollusion); GENE 4: KEY NEW / KEEP (the first melodic track's key and mode kept), ENTRY ALL / BUILD (the new piece in a track a bar, the kit first); the old DIGITAL / NOISE / retired engines' conversions out (flash), the songs 7-8 notice out; voices past V10.6c's budget: tails first, FM6's quarter rate gone. V10.7.65: the PUNCH-IN EDITOR (the owner): OCT+ on FX > PUNCH IN opens it (the FX layer locked open; an ERASE picked on KNOB 4: OCT+ does it), DICE gone; the COMB / COMB- cut-off moved by the LFO and the ENV as the other filters; a key held and KNOB 1..4 its EFFECT (any, MOD a macro moved) TARGET (ALL SYN DRM T1..T6; MOD M1..M4) AMOUNT (MOD 1 BEAT .. 4 BARS) MODE (HOLD LATCH QUANT; MOD RAMP UP / DOWN SINE S&H), the mode said in the header; SELECT a slot (four, in the settings), OCT+ saves and plays it, OCT- leaves. V10.7.64: SCENE's LEADER PRESS (a key's note on every live track at once, each its own sound); SCENE on the live tracks only (it opened on T6, asleep with four: nothing heard, nothing drawn), every role with the key: a kit's DRUM loops its beat while a key is held, stopped too; the engines as the kit (the owner): FILTER TYPE CUT RES IMAGE (DIST the SENDS' only), PLAY POLY GLIDE UNISON VEL (the plain MORE gone, GL MODE off the panel), GAIN 0..+12 dB clean where a DRIVE was (ANALOG's MORE, WHEEL's COLOR; their DRIVE off the panel, kept), saved ('T' 'G'); FUGA's subject and answer on live tracks (the continuo after: with four tracks it began unheard); DUBSTEP's bass the wobble (a resonant low-pass on aLine truncated
#define FELUCCA_VERSION "V10.8.34" /* (2026-11-23) V10.8.21: SEQ > CLAY (the owner): DRONE CLAY, JIANT BYTE's drone and its four modulators (DEST SHAPE EUCLID AMOUNT; DECAY, STEP, SEED) on any track, kept with the project ('C' 'Y'), its pages' picture the modulators' telemetry. V10.7.77: GEN (the owner): DUBSTEP's wobble its rate moving (the wobble bass's LFO RATE automated half a bar each: 1/4 1/8 1/8T 1/16); CUMBIA villera one throw in two (a villera 'teclado': 92 .. 100, minor, the keyboard's lead up front). V10.7.76: DRUM-X MATH a wavetable (the owner: "harsh"): its t whole cycles of the hit's time (one shape evolving), interpolated between its samples; SOUND 3 draws it (four moments, cold to hot); hints trimmed (flash). V10.7.75: DRUM-X MATH (the owner): its RATIO (1/4 .. 16, 24, the inharmonic between) on SOUND 3's KNOB 4, COLOR read MOD AMT; MATH's RESTART the scope (its ramps' picture gone), ten more hints out (flash). V10.7.74: DRUM-X MATH (the owner): a sound's WAVE past BELL a MATH formula F01..F48 as its FM's modulator (COLOR its index; its t the hit's time, a sample in eight), kept with the project ('D' 'F'). V10.7.73: SCL > HARMONY its own tab (KEY CHORD HARMONY SCENE); the defaults once (the owner): LARGE off, CLICK REC, COUNT-IN 1 BAR. V10.7.72: GEN (the owner): MATH WEST STRING more (the archetypes' third options theirs, 25 %; a bass's one time in ten); GLO > GLOBAL the scope, its bars gone. V10.7.71: SCL > HARMONY's picture (the owner): the progression's chords as roman numerals in the key ("-" minor, "o" diminished), each its root's colour, the one playing lit; the obvious knobs' hints out (flash). V10.7.70: FX > PUNCH IN: KNOB 4 M4 (its ERASE PUNCH LANE's only), so OCT+ always the punch-in editor (an ERASE picked took it). V10.7.69: MATH FLOAT MORPH (the owner): ALGO B where CHIP was, MORPH A -> B where BEND was (between the ends B a sample in eight, interpolated: +12.5 % CPU); MATH's formulas (lofi_float, lofi_byte) their 14 divisions by a constant as multiplies (JIANT BYTE 0.16's build pass, tools/build.py const_divs: exact, less CPU a sample); the MACRO layer's dead branches out (flash). V10.7.68: EUCLID MODES > ROLE (MELODY CHORDS BASS ARP, was CHORD) on the harmony the other melodic tracks play, bar by bar (four bars when it changes), else SCL's key; a recorded melody EUCLID takes: its notes as they were; LFO / FX dice leftovers out (flash). V10.7.67: GEN and EUCLID MUTATE fuse two seeds (the owner: never one as it is; the second far from the first), A+B in the name; FX + OCT+ opens the punch-in editor again (as OCT+ on FX > PUNCH IN). V10.7.66: SCL > HARMONY (PROG LENGTH EVOLVE SKIP: every melodic sequence follows a progression); GEN 8 progressions more (neo-soul, jazz, IDM, progressive); EUCLID's melody CONTOUR RANGE MOTIF CHORD; macros FX > PUNCH IN's only (LFO's layer, HOME > ROUTES gone, MACROS in FX), GLO's layer says G4 UNDO; the PUNCH-IN EDITOR redone (the owner): a key WHAT (an effect, or PARAM: M1..M4, CUT PITCH TIMBRE VOLUME PAN DIST CHORUS DELAY REVERB VIBRATO on every track), HOW (an effect HOLD LATCH QUANT; PARAM HOLD RAMP UP RAMP DN SINE STUTTER S&H), AMOUNT (-100..+100 %; an effect its TARGET), TIME (1/16 .. 8 BARS); two slots A B; FX > PUNCH IN its knobs M1..M4 (PUNCH LANE: LEN RES); the layers MAP only (KNOBS STATE gone, ALGORITHM nothing held), the FX cards "M1 CUT"; FX + SELECT the FX pages (its dice gone). GENE while it plays waits for the bar to end (Hollusion); GENE 4: KEY NEW / KEEP (the first melodic track's key and mode kept), ENTRY ALL / BUILD (the new piece in a track a bar, the kit first); the old DIGITAL / NOISE / retired engines' conversions out (flash), the songs 7-8 notice out; voices past V10.6c's budget: tails first, FM6's quarter rate gone. V10.7.65: the PUNCH-IN EDITOR (the owner): OCT+ on FX > PUNCH IN opens it (the FX layer locked open; an ERASE picked on KNOB 4: OCT+ does it), DICE gone; the COMB / COMB- cut-off moved by the LFO and the ENV as the other filters; a key held and KNOB 1..4 its EFFECT (any, MOD a macro moved) TARGET (ALL SYN DRM T1..T6; MOD M1..M4) AMOUNT (MOD 1 BEAT .. 4 BARS) MODE (HOLD LATCH QUANT; MOD RAMP UP / DOWN SINE S&H), the mode said in the header; SELECT a slot (four, in the settings), OCT+ saves and plays it, OCT- leaves. V10.7.64: SCENE's LEADER PRESS (a key's note on every live track at once, each its own sound); SCENE on the live tracks only (it opened on T6, asleep with four: nothing heard, nothing drawn), every role with the key: a kit's DRUM loops its beat while a key is held, stopped too; the engines as the kit (the owner): FILTER TYPE CUT RES IMAGE (DIST the SENDS' only), PLAY POLY GLIDE UNISON VEL (the plain MORE gone, GL MODE off the panel), GAIN 0..+12 dB clean where a DRIVE was (ANALOG's MORE, WHEEL's COLOR; their DRIVE off the panel, kept), saved ('T' 'G'); FUGA's subject and answer on live tracks (the continuo after: with four tracks it began unheard); DUBSTEP's bass the wobble (a resonant low-pass on aLine truncated
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
+58 -16
View File
@@ -1260,8 +1260,10 @@ static void gl_write(track_t *t, gline_t *L, uint32_t len, uint32_t legato)
* dotted push ..); (V10.6p) bit p the step p (were text: 228 B less): x..x..x...x..... x.x.x...x.x..... x...x.x.x.......
* ..x...x...x...x. x..x.x..x..x.x.. x.......x.x.x... x...x...x...x... x.x...x.x...x... ..x.x...x.x..... x..x..x..x..x...
* x.....x...x.x... x...x.x.......x. */
static const uint16_t GL_CELL[12] = {0x0449u, 0x0515u, 0x0151u, 0x4444u, 0x2929u, 0x1501u, 0x1111u, 0x1145u, 0x0514u,
0x1249u, 0x1441u, 0x4051u};
static const uint16_t GL_CELL[16] BTAPP_RO = {0x0449u, 0x0515u, 0x0151u, 0x4444u, 0x2929u, 0x1501u, 0x1111u, 0x1145u, 0x0514u,
0x1249u, 0x1441u, 0x4051u, 0x0149u, 0x1454u, 0x0941u, 0x2425u}; /* (V10.8.34: four
* more, syncopated: x..x..x.x....... ..x.x.x...x.x... x.....x.x..x....
* x.x..x....x..x..) */
enum { LB_M, LB_V, LB_R, LB_C, LB_REST }; /* a bar of the phrase: the motif, varied, the answer, the
* continuation, a rest */
/* (V10.6p) a riff as written (gen_tables.c BASS_ARCH's BA_RF1 ..): its codes the key's degrees from the tonic (R .. 9:
@@ -1429,20 +1431,25 @@ BTAPP_FN static void gen_lead(track_t *t, uint32_t len) /* (V10.7.56: the segm
{LB_M, LB_M, LB_M, LB_V}, /* the hook: A A A A' */
{LB_M, LB_R, LB_M, LB_R}, /* call and response */
{LB_M, LB_REST, LB_M, LB_V}};/* the dub's: space */
static const int8_t ARCH[6][4] = {{0, 0, 1, 0}, {0, 0, 2, 0}, {0, 0, 1, 0}, {0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 0}};
static const int8_t ARCH[6][4] = {{0, 0, 1, 0}, {0, 0, 2, 0}, {0, 0, 1, 0}, {0, 0, 0, 0}, {0, 2, 0, 3}, {0, 0, 0, 0}}; /* (V10.8.34:
* call and response's answers a third, then a fourth over the call) */
uint8_t at[8], used[16] = {0};
int8_t mo[8];
uint32_t k = 3u + gs.complex / 40u + (a > 60u), nc = 0, tpl, op = gr() % 5u, ct = gr() % 4u; /* (op: the varied
uint32_t k = 3u + gs.complex / 40u + (a > 60u), nc = 0, tpl, op = gr() % 6u, ct = gr() % 4u, sig = 1u + op % 3u; /* (V10.8.34:
* a sixth operator, DISPL: the bar an eighth late; sig: the motif's
* own leap, its signature) */ /* (op: the varied
* bar's: 0 TRUNC, 1 RETRO, 2 END moved, 3 ORN, 4 AUG) */
int32_t anchor, d = 0, pv = 0, base0;
uint32_t cell = GL_CELL[gr() % 12u];
uint32_t cell = GL_CELL[gr() % 16u];
if (a < 35u && k > 3u) k--;
if (k > 6u) k = 6u;
tpl = style == LD_HOOK ? (gch(65) ? 4u : 2u) :
fam == HF_LOOP ? (gch(60) ? 3u : 5u) :
fam == HF_POP ? (gr() % 3u == 0u ? 1u : gch(50) ? 0u : 4u) :
fam == HF_JAZZ || fam == HF_JAZZY ? (gch(40) ? 1u : gch(50) ? 2u : 0u) : (gch(50) ? 0u : 1u);
if (gs.sec) { op = (op + gs.sec) % 5u; tpl = (tpl + gs.sec) % 6u; } /* (V10.6z10) a section's development of the
if (gch(25)) tpl = 4u; /* (V10.8.34, the owner: "call and response") a question and its
* answer (the motif, the motif turned over) a throw in four more */
if (gs.sec) { op = (op + gs.sec) % 6u; tpl = (tpl + gs.sec) % 6u; } /* (V10.6z10) a section's development of the
* same motif: another of the varied bar's operators (TRUNC RETRO
* END ORN AUG), another phrase (the answer inverted, call and
* response, space) */
@@ -1460,9 +1467,12 @@ BTAPP_FN static void gen_lead(track_t *t, uint32_t len) /* (V10.7.56: the segm
int32_t m = (int32_t)gpickw(W, 4), dir;
if (!m && !pv) m = 1; /* (never two repeats running) */
if (m == 3) m = gch(60) ? 3 : 4;
if (j == sig) m = 4 + (int32_t)(ct & 1u); /* (V10.8.34, the owner: "personality") the motif's
* signature: one leap of a fifth or a sixth, its place the seed's
* (filled by the step back after it) */
dir = ct == 0u ? (j <= k / 2u ? 1 : -1) : ct == 1u ? (gch(75) ? -1 : 1) : ct == 2u ? (gch(75) ? 1 : -1) : (j & 1u ? 1 : -1);
if (pv >= 3 || pv <= -3) { m = 1; dir = pv > 0 ? -1 : 1; } /* (the leap filled) */
if (d + dir * m > 4 || d + dir * m < -3) dir = -dir;
if (d + dir * m > 5 || d + dir * m < -4) dir = -dir;
pv = dir * m;
d += pv;
}
@@ -1515,7 +1525,8 @@ BTAPP_FN static void gen_lead(track_t *t, uint32_t len) /* (V10.7.56: the segm
sh += bo;
}
for (j = 0; j < kk; j++) {
uint32_t pos = b0 + (vop == 4u ? at[j] * 2u : at[j]); /* AUG: its first half's rhythm doubled */
uint32_t pos = b0 + (vop == 4u ? at[j] * 2u : vop == 5u ? at[j] + 2u : at[j]); /* AUG: its first half's rhythm
* doubled; DISPL: an eighth late */
int32_t mj = vop == 1u ? mo[kk - 1u - j] - mo[kk - 1u] + mo[0] : mo[j]; /* RETRO: its notes backwards
* from its first (the rhythm kept) */
int32_t dd = anchor + (inv ? -mj + 2 * mo[0] : mj) + sh + arch;
@@ -2074,6 +2085,7 @@ static __attribute__((noinline)) void gtile(track_t *t)
t->p[P_SLEN] = NSTEP;
}
static uint32_t gls_snare(const track_t *t);
BTAPP_FN static void gx_prog(uint32_t fam);
static void gen_parts(void)
{
const ggenre_t *g = gs.g;
@@ -2147,7 +2159,16 @@ static void gen_parts(void)
if (gls.on && gls.v.n && (k == 1u || (k == 3u && gch(50)))) { gs.pn = gls.v.n; memcpy(gs.pdeg, gls.v.deg, 8); } /* (MY
* LOOP: the verse the genre's progression, the break it or the
* drop's) */
if (fam != HF_LOOP && ((form == FM_PARTS && k == 1u) || (form != FM_PARTS && k == 3u))) rot = gsec_rot();
if (fam != HF_LOOP && ((form == FM_PARTS && k == 1u) || (form != FM_PARTS && k == 3u))) {
if (pn > 1u && !gls.on && !glatin() && gch(80)) { /* (V10.8.34, the owner: "different parts within a song") the
* contrast section its own progression, the family's grammar's (as
* many chords as A's, A's qualities), from its predominant */
for (i = 0; i < 6u && (gx_prog(fam), gs.pn != pn || !memcmp(gs.pdeg, pdeg, pn)); i++) {}
if (i < 6u) for (i = 0; i < pn; i++) gs.pq[i] = QQ(pq[i]);
else { memcpy(gs.pdeg, pdeg, sizeof pdeg); memcpy(gs.pq, pq, sizeof pq); gs.pn = pn; }
}
rot = gsec_rot();
}
if (form == FM_PARTS && k == 2u && (gs.hx & HX_LIFT)) {
static const int8_t XL[7] = {1, 3, 5, 6, -1, -3, -5}; /* (0.8.6) EXPLORE: anywhere, not a whole step */
lift = gx.on ? XL[gr() % 7u] : 2;
@@ -2156,10 +2177,12 @@ static void gen_parts(void)
gs.sec = (uint8_t)k; /* (V10.6z10) the section's own variations (gseed_mix, gen_lead) */
en = gs.energy;
if (gls.on) gs.energy = (uint32_t)grr(25, 95); /* (MY LOOP: a seed's energy a section) */
gs.reg = (int8_t)(k == 2u ? 5 : k == 1u ? -4 : 0); /* (V10.8.34) a section's register its own: the arp's and the
* lead's windows a fourth up in C, a third down in B */
if (pn == 1u) { /* (V10.6z10) one chord: the section's register and density its
* own (C up a fifth and busier, B and D thinner, D down a fourth:
* the arp's rate, the lead's notes, the chords' pulse by ENERGY) */
gs.reg = (int8_t)(k == 2u ? 7 : k == 3u ? -5 : 0);
if (k == 3u) gs.reg = -5;
gs.energy = k == 2u ? (en + 100u) / 2u : en * 2u / 3u;
}
if (gls.on || form != FM_CLUB || k != 1u) gen_pitched(rot, lift); /* (B: A's but the crash; MY LOOP: every
@@ -2524,6 +2547,24 @@ static void gen_post(void)
if (i + 1u < len && trk[bs].step[i + 1u].time == ST_NOTE && gch(GG_SLD(gg) * 12u)) s->flags |= SF_SLIDE;
if (i % 4u == 2u && s->n == 1u && s->note[0] <= 52u && gin_mode(s->note[0]) && gch(GG_OCT(gg) * 12u)) s->note[0] += 12;
}
{ /* (V10.8.34, the owner: "call and response") a dialogue, a throw in two: where the lead speaks (two notes or
* more in a half bar) the arp is silent, and answers in its gaps; not where the lead leaves it none */
uint32_t ld = gs.trk_of[RL_LEAD], ar = gs.trk_of[RL_ARP], c = 0, kill = 0, busy = 0, j;
if (ld < NTRK && ar < NTRK && gs.act[RL_LEAD] && gs.act[RL_ARP] && !gx.on && gch(50)) {
uint32_t ll = dlen(&trk[ld]);
len = dlen(&trk[ar]);
for (k = 0; k < 2u; k++) /* (the first pass counts the lead's busy half bars) */
for (i = 0; i < len && busy * 4u <= len / 8u * 3u; i++) {
step_t *s = &trk[ar].step[i];
if (!(i & 7u)) {
for (j = c = 0; j < 8u; j++) c += trk[ld].step[(i + j) % ll].time == ST_NOTE;
if (!k) busy += c >= 2u;
}
if (!k) continue;
if (c >= 2u || (kill && s->time == ST_TIE)) { gclear(s); kill = 1; } else kill = 0;
}
}
}
gq = q0;
}
/* (0.8.3: the lead's clashes with the bass are avoided as it is written, against the chord's root: so turning
@@ -2565,14 +2606,13 @@ static void gen_post(void)
* line: its notes are composed) */
uint32_t c = gr() % 3u;
if (s->time != ST_NOTE || !gin_mode(s->note[0])) continue;
uint32_t cc = c == 0u ? CP_ECHO : c == 1u ? CP_BEND : CP_PULSE;
comp_legacy(s, 0, cc, cc == CP_ECHO ? gr() % 2u : cc == CP_BEND ? (gch(50) ? 2u : 10u) : 1u);
uint32_t cc = c ? CP_ECHO : CP_PULSE; /* (V10.8.34: no BEND thrown onto the line: a cartoon's) */
comp_legacy(s, 0, cc, cc == CP_ECHO ? gr() % 2u : 1u);
} else { /* (the arp: its chord's tones; 0.8.3: no RAND, no WALK; gen3: the
* SEQ walker, its steps from this one on) */
uint32_t c = gr() % 4u;
uint32_t cc = c == 0u ? CP_OCT : c == 1u ? CP_ECHO : c == 2u ? CP_CLIMB : CP_ARPQ;
comp_legacy(s, 0, cc, cc == CP_OCT ? 4u : cc == CP_CLIMB ? CP_WARG(2u + gr() % 6u, gch(50) ? 2u : 0u, gr() % 2u) :
cc == CP_ARPQ ? CP_ARG(0u, 0u, 0u) : 0u);
uint32_t cc = c == 0u ? CP_OCT : c == 3u ? CP_ARPQ : CP_ECHO; /* (V10.8.34: no CLIMB) */
comp_legacy(s, 0, cc, cc == CP_OCT ? 4u : cc == CP_ARPQ ? CP_ARG(0u, 0u, 0u) : 0u);
if (c == 1u && gs.energy > 60u && gch(50)) { s->comp = 0; s->clen[0] = 0; step_set_ratchet(s, 2); }
}
if (s->comp && gch(55)) { /* (every other loop; gen3: or once in four, the third of four:
@@ -2710,7 +2750,9 @@ BTAPP_FN static void gen_pick(void)
p = &PROG[gminor() ? (gs.sc[1] == 1u ? PR_PHRY : gs.sc[6] == 11u ? PR_I_IV : PR_I_VII) : gs.sc[3] == 6u ? PR_I_II : PR_I_IV];
if (!gprog_ok(p)) p = &PROG[PR_ONE];
}
if (!glatin() && !gch(p->n == 1u ? 50u : 35u)) { /* (V10.7.2: the latin genres' progressions their own) */
if (!glatin() && !gls.on && p->n > 1u && gch(25) && gprog_ok(&PROGF[t = 2u * HXF(g->hx) + (gr() & 1u)])) p = &PROGF[t]; /* (V10.8.34)
* the family's own two, a throw in four */
else if (!glatin() && !gch(p->n == 1u ? 50u : 35u)) { /* (V10.7.2: the latin genres' progressions their own) */
gx_prog(HXF(g->hx));
pg.n = gs.pn; memcpy(pg.deg, gs.pdeg, 4); memcpy(pg.q, gs.pq, 4);
if (pg.n != 3u && gprog_ok(&pg)) p = &pg; /* (a chord the mode would not take left out: never three,
+18
View File
@@ -371,6 +371,24 @@ static const gprog_t PROG[PR_N] = {
[PR_PROG1] = {4, {0, 1, 3, 0}, {Q_ADD9, Q_TRI, Q_7, Q_ADD9}}, /* I II IV I: the lydian lift */
[PR_PROG2] = {4, {0, 5, 2, 6}, {Q_SUS2, Q_7, Q_TRI, Q_SUS4}}, /* i bVI bIII bVII, suspended: progressive's */
};
static const gprog_t PROGF[12] BTAPP_RO = { /* (in the segment, with gen_pick: the image's tables stay put) */
/* (V10.8.34, the owner: "more progressions") two more a harmony family (gen.c gen_pick: one throw in four, where the
* mode takes it), the records' own: HF_LOOP i iv i v, i III VII iv; JAZZY the minor cycle of fourths iv7 VII7 IIImaj7
* VImaj7, i7 VI7 iv7 v7; POP I V vi IV, vi IV I V; COLOR I bVII IV I (mixolydian's), IV I V vi; CINE i VI III V, i III
* iv VI; JAZZ Imaj7 IVmaj7 iii7 VI7, ii7 V7 iii7 VI7 (back to ii by its dominant) */
{4, {0, 3, 0, 4}, {Q_TRI, Q_TRI, Q_TRI, Q_TRI}},
{4, {0, 2, 6, 3}, {Q_TRI, Q_TRI, Q_TRI, Q_TRI}},
{4, {3, 6, 2, 5}, {Q_7, Q_7, Q_7, Q_7}},
{4, {0, 5, 3, 4}, {Q_7, Q_7, Q_7, Q_7}},
{4, {0, 4, 5, 3}, {Q_TRI, Q_TRI, Q_TRI, Q_TRI}},
{4, {5, 3, 0, 4}, {Q_TRI, Q_TRI, Q_TRI, Q_TRI}},
{4, {0, 6, 3, 0}, {Q_ADD9, Q_TRI | F_FLAT, Q_7, Q_ADD9}},
{4, {3, 0, 4, 5}, {Q_ADD9, Q_7, Q_TRI, Q_7}},
{4, {0, 5, 2, 4}, {Q_TRI, Q_TRI, Q_TRI, Q_TRI | F_MAJ}},
{4, {0, 2, 3, 5}, {Q_TRI, Q_TRI, Q_TRI, Q_TRI}},
{4, {0, 3, 2, 5}, {Q_7, Q_7, Q_7, Q_7 | F_DOM}},
{4, {1, 4, 2, 5}, {Q_7, Q_7, Q_7, Q_7 | F_DOM}},
};
/* (0.8.3) a genre's harmony: its family (how it composes) and what it may colour with */
enum { HF_LOOP, HF_JAZZY, HF_POP, HF_COLOR, HF_CINE, HF_JAZZ }; /* modal loops; 7th loops; functional pop; colour
* washes; film; jazz (ii-V, secondary dominants) */
+46
View File
@@ -0,0 +1,46 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
* The generator's sounds and mix audited (docs/GENERATOR-STUDY.es.md): N seeds a genre, each role's engines and the
* parameters GEN leaves on its track (means), the tempo and the swing.
* cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src -Itests -o build/host/gen_audit tests/gen_audit.c -lm
* build/host/gen_audit [SEEDS [GENRE]] */
#define UI_TEST_NO_MAIN 1
#include "ui_test.c"
static const char *RLN[6] = {"DRUM", "BASS", "PAD", "LEAD", "ARP", "TEX"};
int main(int argc, char **argv)
{
static const int ID[] = {P_LEVEL, P_PAN, P_FCUT, P_FRES, P_ATK, P_DEC, P_SUS, P_REL, P_REV, P_DLY, P_DIST, P_CHOR, P_GLIDE, P_DETUNE, P_E4};
static const char *IN[] = {"LEVEL", "PAN", "FCUT", "FRES", "ATK", "DEC", "SUS", "REL", "REV", "DLY", "DIST", "CHOR", "GLIDE", "DETUN", "E5"};
uint32_t seeds = argc > 1 ? (uint32_t)atoi(argv[1]) : 16, only = argc > 2 ? (uint32_t)atoi(argv[2]) : 0, g, s, k, r, i;
ui_power_on(); go_home(); frames(4);
ui_rec_prefs |= PREF_SIX >> 8; rp_apply();
for (g = only ? only : 1; g <= (only ? only : NGENRE + 1u); g++) {
double sum[6][16]; uint32_t n[6], eng[6][NENGINES], bl = 999, bh = 0; int sw = 0;
memset(sum, 0, sizeof sum); memset(n, 0, sizeof n); memset(eng, 0, sizeof eng);
for (s = 1; s <= seeds; s++) {
gp.genre = (uint8_t)g; gp.seed = (uint16_t)(s * 37u); gp.energy = 50; gp.form = 0;
for (k = 0; k < GP_N; k++) gp.amt[k] = 60; /* (every part on: its sound heard) */
gp.complex = 50; gp.swing = GA_AUTO; gp.human = 30;
gen_go();
if ((uint32_t)song.g[G_BPM] < bl) bl = (uint32_t)song.g[G_BPM];
if ((uint32_t)song.g[G_BPM] > bh) bh = (uint32_t)song.g[G_BPM];
sw = song.g[G_SWING];
for (k = 0; k < NTRK; k++) {
r = gs.role[k];
if (!gs.act[r] || (r == RL_TEX && k != gs.trk_of[RL_TEX])) continue;
n[r]++; eng[r][trk[k].eng_req % NENGINES]++;
for (i = 0; i < 15u; i++) sum[r][i] += trk[k].p[ID[i]];
}
}
printf("\n### %s BPM %u..%u swing %d master: REV type %d DLY time %d\n", g <= NGENRE ? GENRE[g - 1].name : "EXPLORE", bl, bh, sw, song.g[G_RTYPE], song.g[G_DTIME]);
printf("%-5s %-22s", "role", "engines"); for (i = 0; i < 15u; i++) printf(" %5s", IN[i]); printf("\n");
for (r = 0; r < 6u; r++) {
char eb[64] = ""; if (!n[r]) continue;
for (k = 0; k < NENGINES; k++) if (eng[r][k]) { char t[24]; sprintf(t, "%s%u ", ENGINES[k]->name, eng[r][k]); if (strlen(eb) + strlen(t) < 60) strcat(eb, t); }
printf("%-5s %-22s", RLN[r], eb);
for (i = 0; i < 15u; i++) printf(" %5.0f", sum[r][i] / n[r]);
printf("\n");
}
}
return 0;
}
+64
View File
@@ -0,0 +1,64 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
* The generator's mix measured (docs/GENERATOR-STUDY.es.md): a genre's pieces with every part on, each role alone
* (the others muted), 6 s each: its RMS against the drums' (dB) and its brightness (zero crossings a second / 2: a
* centroid's stand-in).
* cc -O2 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src -Itests -o build/host/gen_stems tests/gen_stems.c -lm
* build/host/gen_stems [SEEDS [GENRE]] */
#define UI_TEST_NO_MAIN 1
#include "ui_test.c"
static const char *RLN[6] = {"DRUM", "BASS", "PAD", "LEAD", "ARP", "TEX"};
static void render(double secs, double *rms, double *zc)
{
uint32_t nsamp = 0, want = (uint32_t)(secs * FS), f = 0, i; double e = 0; uint32_t z = 0; int32_t pv = 0;
transport_req = 1;
while (nsamp < want) {
uint32_t upto = (uint32_t)((uint64_t)(++f) * FS / 30u);
ui_input(); song_poll();
while (nsamp < upto && nsamp < want) {
int32_t o[2 * CTL];
mix_block(o, CTL);
for (i = 0; i < CTL; i++) { int32_t m = (o[2 * i] + o[2 * i + 1]) / 2; e += (double)m * m; z += (m >= 0) != (pv >= 0); pv = m; }
nsamp += CTL;
}
host_ticks += 1000000u / 30u; fm1_ms += 1000u / 30u;
}
transport_req = 2; ui_input();
for (i = 0; i < 40u; i++) { int32_t o[2 * CTL]; mix_block(o, CTL); }
*rms = 10.0 * log10(e / nsamp / (32768.0 * 32768.0) + 1e-12); *zc = z * FS / (2.0 * nsamp);
}
int main(int argc, char **argv)
{
uint32_t seeds = argc > 1 ? (uint32_t)atoi(argv[1]) : 3, only = argc > 2 ? (uint32_t)atoi(argv[2]) : 0, g, s, k, r;
double tot[6] = {0}; uint32_t tn[6] = {0};
ui_power_on(); go_home(); frames(4);
ui_rec_prefs |= PREF_SIX >> 8; rp_apply();
song.master_q12 = 4096;
printf("%-15s %6s | rel dB to the drums (brightness Hz): BASS PAD LEAD ARP TEX | mix dB\n", "genre", "DRUM");
for (g = only ? only : 1; g <= (only ? only : NGENRE); g++) {
double sum[6] = {0}, zs[6] = {0}, mixs = 0; uint32_t n[6] = {0};
for (s = 1; s <= seeds; s++) {
int16_t mu[NTRK]; double rm, zc, d0 = 0;
gp.genre = (uint8_t)g; gp.seed = (uint16_t)(s * 37u); gp.energy = 50; gp.form = 0;
for (k = 0; k < GP_N; k++) gp.amt[k] = 60;
gp.complex = 50; gp.swing = GA_AUTO; gp.human = 30;
gen_go();
for (k = 0; k < NTRK; k++) mu[k] = trk[k].p[P_MUTE];
render(6.0, &rm, &zc); mixs += rm;
for (r = 0; r < 6u; r++) {
uint32_t any = 0;
for (k = 0; k < NTRK; k++) { int on = gs.role[k] == r && gs.act[r] && !(r == RL_TEX && k != gs.trk_of[RL_TEX]); trk[k].p[P_MUTE] = (int16_t)!on; any |= on; }
if (!any) continue;
render(6.0, &rm, &zc);
if (r == 0) d0 = rm;
sum[r] += r ? rm - d0 : rm; zs[r] += zc; n[r]++;
}
for (k = 0; k < NTRK; k++) trk[k].p[P_MUTE] = mu[k];
}
printf("%-15s %6.1f |", GENRE[g - 1].name, n[0] ? sum[0] / n[0] : 0);
for (r = 1; r < 6u; r++) { if (n[r]) { printf(" %5.1f (%4.0f)", sum[r] / n[r], zs[r] / n[r]); tot[r] += sum[r] / n[r]; tn[r]++; } else printf(" - "); }
printf(" | %5.1f\n", mixs / seeds);
}
printf("%-15s |", "MEAN"); for (r = 1; r < 6u; r++) printf(" %5.1f ", tn[r] ? tot[r] / tn[r] : 0); printf("\n");
return 0;
}
+103
View File
@@ -0,0 +1,103 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
* The generator measured (firmware/src/gen.c), for docs/GENERATOR-STUDY.es.md: N seeds a genre, FORM PARTS, and what
* a musician would count: how many different progressions, whether the sections differ (their chords, who plays, how
* dense), the lead's shape (notes a bar, steps and leaps, its range, the motif's rhythm coming back, bars repeated
* note for note), call and response (the lead resting while a second voice plays, and back), the bass on the kick.
* cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src -Itests -o build/host/gen_study tests/gen_study.c -lm
* build/host/gen_study [SEEDS [GENRE]] (a line a genre, then the mean) */
#define UI_TEST_NO_MAIN 1
#include "ui_test.c"
typedef struct { double v[16]; } row_t;
enum { M_PROGS, M_SECDIFF, M_SECWHO, M_NPB, M_STEP, M_LEAP, M_RANGE, M_RHY, M_SAME, M_CALL, M_BK, M_LEADON, M_DENS, M_SECDENS, M_IDENT, M_N };
static const char *MN[M_N] = {"progs", "secChord", "secWho", "ld n/bar", "step%", "leap%", "range", "rhyBack%", "sameBar%", "call%", "bassKick%", "lead%", "voices", "secDens", "ident"};
static uint32_t chord_sig(void)
{
uint32_t k, h = 2166136261u;
for (k = 0; k < gs.nch; k++) { h = (h ^ gs.ch[k].deg) * 16777619u; h = (h ^ gs.ch[k].q) * 16777619u; h = (h ^ gs.ch[k].alt) * 16777619u; h = (h ^ gs.ch[k].len) * 16777619u; }
return h;
}
static uint32_t bar_rhy(const track_t *t, uint32_t b) { uint32_t i, m = 0; for (i = 0; i < 16u; i++) m |= (uint32_t)(t->step[b * 16u + i].time == ST_NOTE && t->step[b * 16u + i].n) << i; return m; }
static uint32_t bar_sig(const track_t *t, uint32_t b) { uint32_t i, h = 2166136261u; for (i = 0; i < 16u; i++) { const step_t *s = &t->step[b * 16u + i]; h = (h ^ (s->time == ST_NOTE && s->n ? s->note[0] : s->time)) * 16777619u; } return h; }
static uint32_t onsets(const track_t *t, uint32_t len) { uint32_t i, n = 0; for (i = 0; i < len; i++) n += t->step[i].time == ST_NOTE && (t->step[i].n || t->step[i].hit); return n; }
static uint32_t sec_chords(const project_t *p, uint32_t pd) /* a stored section's chords: the pad's (or any pitched track's) pitch classes a bar */
{
uint32_t i, j, h = 2166136261u;
for (i = 0; i < 64u; i++) { const step_t *s = &p->t[pd].step[i]; uint32_t m = 0; if (s->time != ST_NOTE) continue; for (j = 0; j < s->n; j++) m |= 1u << (s->note[j] % 12u); h += (m * 2654435761u) ^ (m << 7); } /* (the chords as a set: the same ones turned are the same) */
return h;
}
int main(int argc, char **argv)
{
uint32_t seeds = argc > 1 ? (uint32_t)atoi(argv[1]) : 24, only = argc > 2 ? (uint32_t)atoi(argv[2]) : 0, g, s, k, m;
row_t tot; uint32_t ng = 0;
memset(&tot, 0, sizeof tot);
ui_power_on(); go_home(); frames(4);
ui_rec_prefs |= PREF_SIX >> 8; rp_apply();
printf("%-14s", "genre"); for (m = 0; m < M_N; m++) printf(" %9s", MN[m]); printf("\n");
for (g = only ? only : 1; g <= (only ? only : NGENRE + 1u); g++) {
row_t r; uint32_t sigs[64], nsig = 0, nl = 0, nb = 0, npart = 0; uint32_t ids[64], nid = 0;
memset(&r, 0, sizeof r);
for (s = 1; s <= seeds; s++) {
static project_t p;
uint32_t ld, bs, pd, ar, dr, len, bars, i, cs, steps = 0, leaps = 0, ivs = 0, lo = 127, hi = 0, back = 0, same = 0, cmp = 0, call = 0, cb = 0, bk = 0, bo = 0, act = 0, idh;
gp.genre = (uint8_t)g; gp.seed = (uint16_t)(s * 37u); gp.energy = 50; gp.form = 1;
for (k = 0; k < GP_N; k++) gp.amt[k] = getenv("GEN_ALL") ? 60 : GA_AUTO; /* (GEN_ALL=1: every part on) */
gp.complex = 50; gp.swing = GA_AUTO; gp.human = 30;
gen_go();
ld = gs.trk_of[RL_LEAD]; bs = gs.trk_of[RL_BASS]; pd = gs.trk_of[RL_PAD]; ar = gs.trk_of[RL_ARP]; dr = gs.trk_of[RL_DRUM];
cs = chord_sig();
for (k = 0; k < nsig && sigs[k] != cs; k++) {}
if (k == nsig && nsig < 64u) sigs[nsig++] = cs;
for (k = 1; k < RL_N; k++) act += gs.act[k] != 0;
r.v[M_DENS] += act;
/* identity: the lead's first bar rhythm + the bass's first bar rhythm + the tempo's ten + the chord count */
idh = (ld < NTRK && gs.act[RL_LEAD] ? bar_rhy(&trk[ld], 0) : 0) * 31u + (bs < NTRK ? bar_rhy(&trk[bs], 0) : 0) * 7u + gs.nch;
for (k = 0; k < nid && ids[k] != idh; k++) {}
if (k == nid && nid < 64u) ids[nid++] = idh;
if (ld < NTRK && gs.act[RL_LEAD] && onsets(&trk[ld], dlen(&trk[ld]))) {
const track_t *t = &trk[ld]; int32_t pv = -1; uint32_t r0;
len = dlen(t); bars = len / 16u; if (!bars) bars = 1;
r.v[M_NPB] += (double)onsets(t, len) / bars;
for (i = 0; i < len; i++) { const step_t *x = &t->step[i]; if (x->time != ST_NOTE || !x->n) continue;
if (x->note[0] < lo) lo = x->note[0]; if (x->note[0] > hi) hi = x->note[0];
if (pv >= 0) { int32_t d = (int32_t)x->note[0] - pv; if (d < 0) d = -d; ivs++; steps += d <= 2; leaps += d > 7; } pv = x->note[0]; }
r0 = bar_rhy(t, 0);
for (i = 1; i < bars; i++) { cmp++; back += bar_rhy(t, i) == r0 && r0; same += bar_sig(t, i) == bar_sig(t, i - 1u) || (i >= 2u && bar_sig(t, i) == bar_sig(t, i - 2u)); }
if (ivs) { r.v[M_STEP] += 100.0 * steps / ivs; r.v[M_LEAP] += 100.0 * leaps / ivs; }
r.v[M_RANGE] += hi >= lo ? hi - lo : 0;
if (cmp) { r.v[M_RHY] += 100.0 * back / cmp; r.v[M_SAME] += 100.0 * same / cmp; }
/* call and response: half bars where the lead rests and the arp (or the pad's rhythm) sounds onsets, next to
* half bars where the lead plays */
for (i = 0; i + 16u <= len; i += 8u) {
uint32_t j, lo1 = 0, lo2 = 0, o1 = 0, o2 = 0; const track_t *ot = ar < NTRK && gs.act[RL_ARP] ? &trk[ar] : pd < NTRK && gs.act[RL_PAD] ? &trk[pd] : t;
for (j = 0; j < 8u; j++) { lo1 += t->step[i + j].time == ST_NOTE; lo2 += t->step[i + 8u + j].time == ST_NOTE; o1 += ot->step[(i + j) % dlen(ot)].time == ST_NOTE; o2 += ot->step[(i + 8u + j) % dlen(ot)].time == ST_NOTE; }
cb++; call += (lo1 >= 2u && !o1 && o2 && lo2 <= 1u) || (lo2 >= 2u && !o2 && o1 && lo1 <= 1u); /* (one speaks, the other is silent; then the other) */
}
if (cb) r.v[M_CALL] += 100.0 * call / cb;
nl++;
}
if (bs < NTRK && gs.act[RL_BASS]) { const track_t *t = &trk[bs]; len = dlen(t);
for (i = 0; i < len; i++) if (t->step[i].time == ST_NOTE && t->step[i].n) { bo++; bk += GKICK(i); }
if (bo) { r.v[M_BK] += 100.0 * bk / bo; nb++; } }
/* the sections: B's and C's chords against A's, who plays, how dense */
{ uint32_t a_ch = pd < NTRK ? 0 : 0, sd = 0, sw = 0, ns = 0, dA = 0, mA = 0; double dd = 0;
if (proj_import(&p, &proj_slot[0], sizeof(project_store_t))) { a_ch = sec_chords(&p, pd < NTRK ? pd : bs); for (k = 0; k < NTRK; k++) { mA |= (uint32_t)(p.t[k].p[P_MUTE] != 0) << k; if (!p.t[k].p[P_MUTE]) { uint32_t i2; for (i2 = 0; i2 < 64u; i2++) dA += p.t[k].step[i2].time == ST_NOTE; } } }
for (m = 1; m < 4u; m++) { uint32_t mm = 0, dS = 0;
if (!((dice_secs >> m) & 1u) || !proj_import(&p, &proj_slot[m], sizeof(project_store_t))) continue;
ns++; sd += sec_chords(&p, pd < NTRK ? pd : bs) != a_ch;
for (k = 0; k < NTRK; k++) { mm |= (uint32_t)(p.t[k].p[P_MUTE] != 0) << k; if (!p.t[k].p[P_MUTE]) { uint32_t i2; for (i2 = 0; i2 < 64u; i2++) dS += p.t[k].step[i2].time == ST_NOTE; } }
sw += mm != mA; dd += dA ? fabs((double)dS - dA) * 100.0 / dA : 0; }
if (ns) { r.v[M_SECDIFF] += 100.0 * sd / ns; r.v[M_SECWHO] += 100.0 * sw / ns; r.v[M_SECDENS] += dd / ns; npart++; } }
}
r.v[M_PROGS] = nsig; r.v[M_IDENT] = nid;
r.v[M_LEADON] = 100.0 * nl / seeds; r.v[M_DENS] /= seeds;
for (m = M_NPB; m <= M_CALL; m++) if (nl) r.v[m] /= nl;
if (nb) r.v[M_BK] /= nb;
if (npart) { r.v[M_SECDIFF] /= npart; r.v[M_SECWHO] /= npart; r.v[M_SECDENS] /= npart; }
printf("%-14s", g <= NGENRE ? GENRE[g - 1].name : "EXPLORE");
for (m = 0; m < M_N; m++) { printf(" %9.1f", r.v[m]); tot.v[m] += r.v[m]; }
printf("\n"); ng++;
}
printf("%-14s", "MEAN"); for (m = 0; m < M_N; m++) printf(" %9.1f", tot.v[m] / ng); printf("\n");
return 0;
}