mirror of
https://github.com/ruppert/fmini-1.git
synced 2026-12-06 04:44:27 +01:00
The project's first name, FMUG, is gone. Nothing about the sound or the stored data changes. - Files: eng_fmini.c, fmini_app.c, ui_fmini.c, editor_fmini.c, eng_fmini_filter.h, eng_fmini_presets.h, the tests, the tools (fmini_bank.py, fmini_filter.py, fmini_retune.py, fmini_levels.json, gen_fmini_presets.py) and web/make_fmini_installer.py. - Identifiers: fmug_ / FMUG_ / FELUCCA_FMUG_ONLY became fmini_ / FMINI_ / FELUCCA_FMINI_ONLY; the editor commands are FMINI_GET / FMINI_PUT / FMINI_PRESET (numbers 82-84 unchanged). The engine reports the name "FMINI" (was "FMUG") on the device and in the editor's engine list; the editor still accepts "FMUG" from firmware up to 1.7.0. - Short forms fmg_ / GR_FMG0..6 and FG_* are left as they are. - Tables: tests/golden.txt and tests/target_budget.txt only had their keys renamed. - Docs: CLAUDE.md and DEVELOPING.md say there is one branch (main) and record the rename; the test-suite notes now describe the second regress section (FELUCCA_CPU2=0: 41 FMINI patches differ from the golden, as on 1.7.0). - Site: docs/emu and docs/index.html rebuilt for v1.7.1; the splash pictures show the new version. Checked: the firmware's instructions are identical to 1.7.0 (only the addresses of string literals move); the 100 FMINI golden hashes are unchanged; every screen of the README shots is pixel-identical except the splash; the preset lab's metrics for the 100 patches are identical; the host suite fails in the same seven sections as before (fm4, ui_render, three regress, union_test, web pages) and nowhere else. Not tested on a real FM-1. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
88 lines
4.0 KiB
Python
88 lines
4.0 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
# FMini-1: the README's pictures (assets/readme/) in the splash's look: the banner (the logo, "by Ruppert" 20 % smaller,
|
|
# the instrument) and the eight screens, one picture each, drawn by the firmware's own code (tools/readme_shots.c).
|
|
# python3 -c "import sys; sys.path.insert(0, 'tools'); import build; build.generate()" # build/gen
|
|
# cc -O1 -w -Ibuild/gen -Ifirmware/src -Itests -o /tmp/shots tools/readme_shots.c -lm && /tmp/shots /tmp/fa
|
|
# python3 tools/gen_readme_art.py /tmp/fa
|
|
# Needs Pillow and the Poppins font.
|
|
import pathlib
|
|
import sys
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
|
OUT = ROOT / "assets" / "readme"
|
|
SPLASH = ROOT / "assets" / "fmini-splash.png"
|
|
FONTS = [pathlib.Path("/usr/share/fonts/truetype/google-fonts"), pathlib.Path.home() / "Library/Fonts",
|
|
pathlib.Path("/Library/Fonts"), pathlib.Path("C:/Windows/Fonts")]
|
|
BLACK = (0, 0, 0) # the splash's background
|
|
CREAM = (0xEC, 0xE4, 0xD0) # fmini_app.c FA_CR
|
|
FRAME = (0x2B, 0x28, 0x25)
|
|
SHOTS = [("splash", "Splash"), ("osc", "OSC"), ("mix", "MIX"), ("filter", "Filter"),
|
|
("fx", "FX"), ("preset", "Preset 00"), ("arp", "ARP"), ("seq", "SEQ")]
|
|
|
|
|
|
def font(name, size):
|
|
for d in FONTS:
|
|
if (d / name).exists():
|
|
return ImageFont.truetype(str(d / name), size)
|
|
raise SystemExit(f"font {name} not found")
|
|
|
|
|
|
def spaced(draw, cx, y, text, f, fill, track):
|
|
"""text with letter spacing, centred on cx, baseline y"""
|
|
widths = [draw.textlength(ch, font=f) for ch in text]
|
|
x = cx - (sum(widths) + track * (len(text) - 1)) / 2
|
|
for ch, w in zip(text, widths):
|
|
draw.text((x, y), ch, font=f, fill=fill, anchor="ls")
|
|
x += w + track
|
|
|
|
|
|
def banner(splash):
|
|
"""the logo on the left, the instrument on the right, on black"""
|
|
W, H, k = 1800, 600, 0.74
|
|
im = Image.new("RGB", (W, H), BLACK)
|
|
logo = splash.crop((70, 115, 1185, 325)) # "FMini-1"
|
|
logo = logo.resize((round(logo.width * k), round(logo.height * k)), Image.LANCZOS)
|
|
by = splash.crop((130, 352, 1122, 456)) # "— by Ruppert —": 20 % smaller than on the splash
|
|
by = by.resize((round(by.width * k * 0.8), round(by.height * k * 0.8)), Image.LANCZOS)
|
|
gap = round(28 * k)
|
|
top = (H - (logo.height + gap + by.height)) // 2 - 10
|
|
im.paste(logo, (40, top))
|
|
im.paste(by, (40 + logo.width // 2 - by.width // 2, top + logo.height + gap)) # both centred as on the splash
|
|
synth = splash.crop((0, 490, 1254, 1180))
|
|
synth = synth.resize((round(synth.width * 0.8), round(synth.height * 0.8)), Image.LANCZOS)
|
|
mask = Image.new("L", synth.size, 255) # its left edge fades into the black
|
|
md = ImageDraw.Draw(mask)
|
|
for x in range(120):
|
|
md.line([(x, 0), (x, synth.height)], fill=255 * x // 120)
|
|
im.paste(synth, (W - synth.width + 10, (H - synth.height) // 2 + 10), mask)
|
|
return im
|
|
|
|
|
|
def screen(src, name, label, scale=2):
|
|
"""one screen in its own picture: a dark rounded frame (transparent corners) with the name under the screen"""
|
|
pad, cap = 12, 58
|
|
sw = 240 * scale
|
|
im = Image.new("RGBA", (sw + 2 * pad, sw + pad + cap), (0, 0, 0, 0))
|
|
d = ImageDraw.Draw(im)
|
|
d.rounded_rectangle((0, 0, im.width - 1, im.height - 1), 16, fill=FRAME + (255,))
|
|
im.paste(Image.open(src / f"shot_{name}.ppm").convert("RGB").resize((sw, sw), Image.NEAREST), (pad, pad))
|
|
spaced(d, im.width / 2, pad + sw + 42, label.upper(), font("Poppins-Medium.ttf", 28), CREAM, 4)
|
|
return im
|
|
|
|
|
|
def main(src):
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
splash = Image.open(SPLASH).convert("RGB")
|
|
banner(splash).save(OUT / "banner.png", optimize=True)
|
|
for name, label in SHOTS:
|
|
screen(pathlib.Path(src), name, label).save(OUT / f"screen-{name}.png", optimize=True)
|
|
print("wrote", ", ".join(sorted(p.name for p in OUT.iterdir())))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) != 2:
|
|
sys.exit(__doc__)
|
|
main(sys.argv[1])
|