mirror of
https://github.com/ruppert/fmini-1.git
synced 2026-12-06 04:44:27 +01:00
MENU > LARGE keeps one size per knob (#251): each knob shows all its values in the size its longest value fits, so a value no longer jumps between sizes while it is turned. No new fonts. Updates check the package's size on the device: the update entry and the update loader take only a package whose firmware area is exactly the FM-1's. Another device's package is refused before anything is erased (the update screen shows FAILED -15; the loader answers -14). Second core (beta, PR #247): MENU > SYSTEM > 2ND CORE, OFF by default. ON (BETA) applies from the next power-on: the second core renders some of the four parts of each block, bit for bit the one-core sound. A unit whose second core misreads goes on with one core and sets it back to OFF. FELUCCA_CPU2=0 builds none of it. Start, mailbox and guards from X0X (with Melodee's dual-core findings), the split and hardening after Jangada. Felucca-Engines: ANALOG, LOFI, TRIO, WHEEL and NOISE, the engine interface, the shared DSP helpers and their table generator move to https://github.com/hugelton/Felucca-Engines under the MIT licence, included as the git submodule firmware/engines. The firmware stays GPL-3.0-only; clone with --recurse-submodules. The sound is unchanged (the same golden renders); the engines' own tests run with Felucca's. Co-authored-by: Кирилл Сапфиров <gospodindilly@gmail.com>
67 lines
2.5 KiB
Python
67 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
# Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
|
|
"""Check a recording of the USB audio input of a FELUCCA_UAC_TONE=1 build (src/usb.c): 16-bit stereo WAV,
|
|
recorded at the rate the FM-1 was set to (44.1 or 48 kHz; the triangles are made at that rate, so they
|
|
must arrive exactly). Frame n of the stream is phase ph = n % 100 of
|
|
L = q * 1000 - 25000, R = q2 * 1000 - 25000, q = ph < 50 ? ph : 100 - ph, q2 = |50 - ph|
|
|
so every frame must be the one after the frame before: a lost frame or a repeated one shows as a break.
|
|
The leading silence (the stream starting) and the end of the file are skipped.
|
|
tools/uac_tone_check.py REC.wav [more.wav ...] exit 1 if any file has a break"""
|
|
import sys
|
|
import wave
|
|
from array import array
|
|
|
|
|
|
def tri(ph):
|
|
q = ph if ph < 50 else 100 - ph
|
|
return q * 1000 - 25000, abs(50 - ph) * 1000 - 25000
|
|
|
|
|
|
TRI = [tri(p) for p in range(100)]
|
|
|
|
|
|
def check(path):
|
|
with wave.open(path, "rb") as w:
|
|
ch, width, rate, n = w.getnchannels(), w.getsampwidth(), w.getframerate(), w.getnframes()
|
|
raw = w.readframes(n)
|
|
if ch != 2 or width != 2:
|
|
print(f"{path}: {ch} ch, {8 * width} bit: need a 16-bit stereo recording")
|
|
return False
|
|
a = array("h", raw)
|
|
if sys.byteorder == "big":
|
|
a.byteswap()
|
|
fr = [(a[2 * i], a[2 * i + 1]) for i in range(len(a) // 2)]
|
|
i = 0
|
|
while i < len(fr) and fr[i] == (0, 0):
|
|
i += 1
|
|
start, breaks, first = i, [], None
|
|
ph = None
|
|
while i < len(fr):
|
|
if ph is None: # (re)sync: the phase that fits this frame and the next
|
|
cand = [p for p in range(100) if TRI[p] == fr[i] and i + 1 < len(fr) and TRI[(p + 1) % 100] == fr[i + 1]]
|
|
if not cand:
|
|
i += 1
|
|
continue
|
|
ph = cand[0]
|
|
elif TRI[ph] != fr[i]:
|
|
breaks.append(i)
|
|
if first is None:
|
|
first = i
|
|
ph = None
|
|
continue
|
|
ph = (ph + 1) % 100
|
|
i += 1
|
|
good = len(fr) - start
|
|
print(f"{path}: {rate} Hz, {len(fr)} frames ({len(fr) / rate:.1f} s), from frame {start}: "
|
|
f"{len(breaks)} break(s)" + (f", first at frame {first} ({first / rate:.3f} s)" if breaks else "")
|
|
+ (f"; {good} frames checked" if good else ""))
|
|
return not breaks and good > 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 2:
|
|
sys.exit(__doc__)
|
|
ok = all([check(p) for p in sys.argv[1:]])
|
|
sys.exit(0 if ok else 1)
|