Files
JIANT/tools/dice_render.c
T
Claude 329aff53fa 0.9.12 draft: 12 voices with the second core, sound types + PRESETS by type, MIDI LEARN (MENU > MIDI), FM6 bank sector guard, copyright lines
- voice.c voice_cap: VOICES_2CORE 12 while the second core takes parts (fx.c mc_two: CORES 2, not REC at
  power-on, not given up); one core 8, LOAD ECO 6; a track still NVOICE 8 (no RAM). After Skiff by illuminus5.
  cpu_vg: mix/v12 (both cores 3924 instr/sample), mix/v12.c0 (core 0 1949), mix/v12.one (one core, 8 voices 3241);
  regress.c chk_budget_2core; the dual-core equivalence test at one budget (mc_host_v12).
- Sound types (PT_BASS..PT_FX) on all factory presets in preset_t.mono bits 1..4 (no format change); PRESETS LIST
  ALL / FAV / BASS LEAD PAD KEYS PLUCK BELL VOX DRUM FX across engines, saved in favorites.factory[15][18];
  gen.c keeps PT_BASS sounds off the other roles (was a name match). After Skiff by illuminus5.
- MIDI LEARN ported from Felucca 1.5 (midi_learn.c): 10 CCs, 3 bytes each in DIGITAL's favourites row, reserved
  CCs and the standard map refused, any channel, USB and TRS; MENU > MIDI tab (MIDI OUT, LEARN, LEARN CLEAR);
  state in the pool.
- fm6_vbank.c: 0xE7000 holding foreign data (Skiff's pattern bank) reads as no bank and is never erased at
  power-on; only a bank the user sends replaces it. fm6bank_test foreign_test.
- Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) in JIANT's files ("Portions" in mostly-Felucca ones),
  README / LICENSING.md / MENU > ABOUT credits (Felucca, Skiff).
- Docs: MANUAL.md / MANUAL.es.md, README v0.9.12 draft, EDITOR_PROTOCOL.md (tabs), cheat sheets, nav map.

Flash 576192 -> 577712 B (+1520), .data+.bss unchanged, pool +8 B (spare 10528 B).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-10-18 18:50:07 +00:00

64 lines
3.2 KiB
C

/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
* (JIANT 0.6.80) DICE ALL heard: pieces from the generator (firmware/src/song_dice.c) on the host build of the tests,
* the real engines playing each at its tempo, written as WAV files, to compare the generator before and after a
* change by ear. Each argument is STYLE:ENERGY:SEED (the genre's index in GENRE (gen_tables.c), the energy 0..2, any seed: the same
* seed, the same throw); the files are DIR/NN_<style>_e<energy>.wav, SECONDS long each (default 20). (0.6.81) A throw
* that made parts plays its song, as PLAY in SONG mode.
* cc -O1 -w -Ibuild/gen -Ifirmware/src -Itests -o build/dice_render tools/dice_render.c -lm
* build/dice_render DIR SECONDS 6:1:11 12:1:22 ... */
#define UI_TEST_NO_MAIN 1
#include "ui_test.c"
int main(int argc, char **argv)
{
const char *dir = argc > 1 ? argv[1] : "build/dice_render";
double secs = argc > 2 ? atof(argv[2]) : 20.0;
int a;
if (secs <= 0) secs = 20.0;
for (a = 3; a < argc; a++) {
int st = 0, en = 1;
unsigned seed = 1;
char path[600], name[64];
uint32_t nsamp = 0, want, f = 0, i;
FILE *wav;
if (sscanf(argv[a], "%d:%d:%u", &st, &en, &seed) < 2) { fprintf(stderr, "STYLE:ENERGY:SEED, not %s\n", argv[a]); return 1; }
ui_power_on();
settings.palette = UI_JIANT_INDEX; palette_set(UI_JIANT_INDEX);
ui_rec_prefs |= PREF_SIX >> 8; rp_apply(); /* TRACKS 6 */
song.master_q12 = 4096;
host_ticks = seed * 7919u;
rng_state = seed * 2654435761u | 1u;
dice_force_style = (int8_t)st; dice_force_energy = (int8_t)en;
dice_all();
dice_force_style = dice_force_energy = -1;
str_cpy(name, GENRE[(uint32_t)st % NGENRE].name, sizeof name);
for (i = 0; name[i]; i++) if (name[i] == ' ') name[i] = '_';
snprintf(path, sizeof path, "%s/%02d_%s_e%d_s%u.wav", dir, a - 2, name, en, seed);
if (!(wav = fopen(path, "wb"))) { fprintf(stderr, "cannot write %s\n", path); return 1; }
wav_hdr(wav, 0);
if (live.mode) chain_play_ui(); /* (0.6.81: its parts in ARRANGE: PLAY plays the song) */
else transport_req = 1;
want = (uint32_t)(secs * FS);
while (nsamp < want) { /* a frame (1/30 s) of the main loop, then its audio */
uint32_t to = (uint32_t)((uint64_t)(++f) * FS / 30u);
ui_input();
song_poll(); /* (the main loop's: the song's next section staged) */
while (nsamp < to && nsamp < want) {
int32_t o[2 * CTL];
int16_t s[2 * CTL];
mix_block(o, CTL);
for (i = 0; i < 2u * CTL; i++) s[i] = (int16_t)clamp(o[i], -32768, 32767);
fwrite(s, 2, 2u * CTL, wav);
nsamp += CTL;
}
host_ticks += 1000000u / 30u; fm1_ms += 1000u / 30u;
}
transport_req = 2; ui_input();
fclose(wav);
if ((wav = fopen(path, "r+b"))) { wav_hdr(wav, nsamp); fclose(wav); }
printf("%s %s energy %d, %d BPM\n", path, GENRE[(uint32_t)st % NGENRE].name, en, song.g[G_BPM]);
}
return 0;
}