mirror of
https://github.com/isod89/clipper-fm1.git
synced 2026-12-05 12:24:32 +01:00
Clean fades (the mix rounded to the nearest); UNISON spread on every engine (FMX, MACRO too) and FMX's unison level; PHYS strings in tune; NOISE LFSR clock past the sample rate (#10) and its pink / brown filter bounded; SAMPLE and GRAIN follow the top keys, GRAIN no longer starved by a released note; a firm press on a layer button opens its pages (TAP 1 s, #24); REC READY's knobs read once; VECTOR's filter states cleared on a MODEL change (no click); FMX: a voice given up starts from rest; Clipper 1.0's values kept beside every project (proj_x10_t, backup object 14); backups keep user wavetables and the user presets' side records and tails (objects 12, 13); TRACK_MIX's EQ LOW bounded; the way back accepts the official V16 (sloop-fm1 #8); a user kit's root, a project's velocities bounded. Version 1.3 (ui.c, build-clipper.ps1, publish_github.ps1, the installer page, docs/release-1.3.md, the guides). New tests for each, goldens updated (the mix's rounding: every render). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AgC1EFHrYDcX1kyyeDW9sw
106 lines
4.4 KiB
C
106 lines
4.4 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only */
|
|
/* VOICE = UNISON (and UNI2 / UNI4) about as loud as POLY, on every engine. Unison starts its extra voices at random
|
|
* phases (voice.c unison_spread) and at a lower level (the velocity: about the same sum). In phase they stack: 8
|
|
* voices at 0.36 are +9 dB over one. unison_spread moved ph[0] only, and most engines keep more oscillators (ph[1],
|
|
* ph[2], operators, a wave sequence's step, a sample's read position): their voices stacked in phase (ANALOG SINE PAD
|
|
* +13.7 dB, PHASE CZ CHOIR +12.8, FMX +11 .. +15, MACRO CHORD / SWARM +13, SAMPLE +7.6 on average). Each engine now
|
|
* spreads all of its oscillators by the same time shift (their relative phases, the timbre, as they were); SAMPLE
|
|
* starts a voice up to four periods later (silence first; at most 256 source samples). FM6 scales UNI4 / UNI2 as
|
|
* UNISON (its operators' levels ignore the velocity when their KVS is 0: UNI4 was +6 dB at random phases, +12 in phase).
|
|
* For every preset of every engine, notes 36 and 60 (velocity 100, chorus, delay, reverb off): the rms over
|
|
* 0.05 .. 0.55 s in UNISON (8 voices, the preset's DETUNE) and in UNI4 (Clipper) against POLY. Fails when a render is
|
|
* more than +8 dB over POLY or an engine's mean over +5 dB. Exit status: failed checks. */
|
|
#define main hostsim_main
|
|
#include "hostsim.c"
|
|
#undef main
|
|
#if CLIPPER_SYNTH
|
|
#define TAPL mix_l
|
|
#define TAPR mix_r
|
|
#else
|
|
#define TAPL acc[0].l
|
|
#define TAPR acc[0].r
|
|
#endif
|
|
static int32_t o[CTL * 2];
|
|
static double play(uint32_t e, uint32_t p, uint32_t mode, uint32_t note)
|
|
{
|
|
uint32_t i, b, k, any = 1;
|
|
double s2 = 0;
|
|
for (k = 0; k < NPART; k++)
|
|
trk_all_off(&trk[k]);
|
|
for (b = 0; b < 6000u && any; b++) { /* the last note rung out */
|
|
mix_block(o, CTL);
|
|
for (any = 0, i = 0; i < NVOICE; i++)
|
|
any |= trk[0].v[i].active;
|
|
}
|
|
for (i = 0; i < P_E0; i++) /* the preset as ui.c apply_preset_to loads it */
|
|
trk[0].p[i] = TP[i].def;
|
|
host_preset(&trk[0], e, p);
|
|
trk[0].p[P_AMODE] = 0, trk[0].p[P_DLY] = trk[0].p[P_REV] = 0, trk[0].p[P_CHOR] = 0;
|
|
trk[0].p[P_VOICE] = (int16_t)mode;
|
|
for (b = 0; b < 16; b++)
|
|
mix_block(o, CTL);
|
|
trk_note_on(&trk[0], note, 100);
|
|
for (b = 0; b < 760; b++) {
|
|
mix_block(o, CTL);
|
|
if (b >= 69)
|
|
for (i = 0; i < CTL; i++) {
|
|
double x = (TAPL[i] + TAPR[i]) / 2.0;
|
|
s2 += x * x;
|
|
}
|
|
}
|
|
trk_note_off(&trk[0], note);
|
|
return sqrt(s2 / ((760 - 69) * CTL));
|
|
}
|
|
#if CLIPPER_SYNTH
|
|
#define NM 2u
|
|
static const uint32_t MODE[NM] = { V_UNISON, V_PUNI4 };
|
|
static const char *const MN[NM] = { "UNISON", "UNI4" };
|
|
#else
|
|
#define NM 1u
|
|
static const uint32_t MODE[NM] = { V_UNISON };
|
|
static const char *const MN[NM] = { "UNISON" };
|
|
#endif
|
|
/* engine e: in each unison mode, the mean unison / POLY ratio (dB) of its presets at notes 36 and 60 */
|
|
static void engine(uint32_t e, int *fails)
|
|
{
|
|
const engine_t *en = ENGINES[e];
|
|
uint32_t p, k, m, n = 0;
|
|
double sum[NM][2], worst[NM], mean;
|
|
const char *wn[NM];
|
|
for (m = 0; m < NM; m++)
|
|
sum[m][0] = sum[m][1] = 0, worst[m] = -99, wn[m] = "";
|
|
for (p = 0; p < en->npresets; p++, n++)
|
|
for (k = 0; k < 2u; k++) {
|
|
uint32_t note = k ? 60u : 36u;
|
|
double r0 = play(e, p, V_POLY, note);
|
|
for (m = 0; m < NM; m++) {
|
|
double d = 20 * log10((play(e, p, MODE[m], note) + 1) / (r0 + 1));
|
|
if (d > 8.0) {
|
|
printf("unison: %-7s %-6s %-14s note %u: %+.1f dB over POLY FAIL\n", en->name, MN[m],
|
|
en->presets[p].name, note, d);
|
|
++*fails;
|
|
}
|
|
if (d > worst[m])
|
|
worst[m] = d, wn[m] = en->presets[p].name;
|
|
sum[m][k] += d;
|
|
}
|
|
}
|
|
for (m = 0; n && m < NM; m++) {
|
|
mean = (sum[m][0] + sum[m][1]) / (2 * n);
|
|
printf("unison: %-7s %-6s mean %+5.1f dB over POLY (note 36 %+5.1f, 60 %+5.1f; %3u presets; the most %+5.1f, %s)%s\n",
|
|
en->name, MN[m], mean, sum[m][0] / n, sum[m][1] / n, n, worst[m], wn[m], mean > 5.0 ? " FAIL" : "");
|
|
if (mean > 5.0)
|
|
++*fails;
|
|
}
|
|
}
|
|
int main(void)
|
|
{
|
|
int fails = 0;
|
|
uint32_t e;
|
|
host_tracks_init();
|
|
for (e = 0; e < NENGINES; e++)
|
|
engine(e, &fails);
|
|
printf("unison: %d failed\n", fails);
|
|
return fails;
|
|
}
|