mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
- Projects written before V10.7 (no SLICER block, CP_* components of before seq2d, retired SAMPLE/PHYS/GRAIN/SLICE engines, the old GM drum part, a JUMP of before V10.6v no RAMP can mean) are no longer migrated on load: refused as old, "OLD PROJECT: OPEN IN STUDIO" (LOAD no longer says EMPTY SLOT for them), the slot in flash never erased or written. +608 B image. - web/emu: web_proj_load(slot, len) / web_proj_save() for Studio's converter. - MOD MATRIX AMOUNT -128..127 (-200 .. +198 %, 64 exactly 100 %): stored compatibly (a parameter byte's 192..255 the negatives; projects, presets, the macros' routes); old routes load as they were. No sound code changed. - GEN: a genre's headroom (GTRIM, after LEVEL's top: every part down by the same), no piece's stem or mix over -1 dBFS before the master (were up to +13 dBFS); tests/gen_peak.c and its CI step; gen-mix measured before the master, bounded at V10.8.50's own balance there. - SEQ: step keys held on the roll, SEL 5-8; SEQ TOOLS' STRETCH / SQUEEZE / REPEAT on that range once (else the whole track), the steps after it moved along, locks with their steps, one UNDO point. - SAVE + D5: PLAY: THE PART. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
81 lines
5.1 KiB
C
81 lines
5.1 KiB
C
/* 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 [c]]]
|
|
* (V10.8.41, the owner: "breakbeat's and acid's bass far too loud") the bass's peak against the drums' too (a resonant line's
|
|
* peaks pass an RMS); c: the check (the workflow's): no genre's bass more than 3 dB over its drums by RMS, 5 by its peak (MINIMAL
|
|
* TECHNO aside: the owner's reference, its sub over the click kit). (V10.8.51) measured before the master (fx.c stem_buf, the
|
|
* stems' point): GEN's pieces under -1 dBFS there now (gen.c GTRIM), the leveler off its floor lifts a part alone up to
|
|
* x2 and the limiter no longer squashes it, so through the master a solo said little of the mix; before the master every
|
|
* part has the mix's own scale. The bounds V10.8.50's own balance there (EBM's bass +6.2 dB by RMS, TRIBAL's +12.6 by its peak,
|
|
* the loudest; through the master it read 3 and 5), to the tenth the same in V10.8.51 */
|
|
#define UI_TEST_NO_MAIN 1
|
|
#include "ui_test.c"
|
|
static const char *RLN[6] = {"DRUM", "BASS", "PAD", "LEAD", "ARP", "TEX"};
|
|
static double pk_db;
|
|
static void render(double secs, double *rms, double *zc)
|
|
{
|
|
int32_t pk = 1;
|
|
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(); fx_stems = 1; /* (V10.8.51: measured before the master, as the stems: every part at the
|
|
* mix's own scale, no leveler lifting a quiet part alone up to x2) */
|
|
while (nsamp < upto && nsamp < want) {
|
|
int32_t o[2 * CTL];
|
|
mix_block(o, CTL);
|
|
for (i = 0; i < CTL; i++) { int32_t m = (stem_fx[0][i] + stem_fx[1][i]) / 2, k2;
|
|
for (k2 = 0; k2 < NPART; k2++) m += stem_buf[k2][i]; e += (double)m * m; if (m > pk) pk = m; if (-m > pk) pk = -m; z += (m >= 0) != (pv >= 0); pv = m; }
|
|
nsamp += CTL;
|
|
}
|
|
host_ticks += 1000000u / 30u; fm1_ms += 1000u / 30u;
|
|
}
|
|
transport_req = 2; ui_input(); fx_stems = 0;
|
|
for (i = 0; i < 40u; i++) { int32_t o[2 * CTL]; mix_block(o, CTL); }
|
|
pk_db = 20.0 * log10(pk / 32768.0);
|
|
*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}; int bad = 0, chk = argc > 3;
|
|
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, pks = 0, p0 = 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; p0 = pk_db; }
|
|
if (r == RL_BASS && n[0]) pks += pk_db - p0;
|
|
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 | bass peak %+5.1f", mixs / seeds, n[1] ? pks / n[1] : 0);
|
|
if (g > 1 && n[0] == seeds && n[1] && (sum[1] / n[1] > 6.5 || pks / n[1] > 13.0)) { bad++; printf(" OVER"); }
|
|
printf("\n");
|
|
}
|
|
printf("%-15s |", "MEAN"); for (r = 1; r < 6u; r++) printf(" %5.1f ", tn[r] ? tot[r] / tn[r] : 0); printf("\n");
|
|
if (chk) printf(bad ? "gen-mix: %d FAILED\n" : "gen-mix: all ok\n", bad);
|
|
return chk && bad;
|
|
}
|