Skip to content

Modernisation: toolchain, hvcc, CMSIS 6, Gen/Faust parameter mapping, unit tests - #134

Merged
pingdynasty merged 39 commits into
masterfrom
feature/modernization
Nov 27, 2026
Merged

pingdynasty merged 39 commits into
masterfrom
feature/modernization

Conversation

@pingdynasty

Copy link
Copy Markdown
Collaborator

Brings the build up to current toolchains and libraries. Bug fixes and performance changes follow in a separate PR.

Toolchain

  • Docker image and CI: Arm GNU 13.3.rel1, emscripten 6.0.13, FAUST 2.88.0, Ubuntu 24.04
  • Fixes for GCC 13 and emscripten 6 compile/link breakages
  • Heavy patches built with mainline hvcc 0.17.3 (hvcc -g owl), replacing the Python 2.7 fork; leftover fork files (HeavySource/, HEAVYSRC) removed
  • HeavyTest disabled in make check for the CI run
  • Native, web and test builds fixed on macOS
  • Dockerfile: stale and redundant comments removed

Libraries

  • CMSIS-DSP v1.10.0 -> v1.18.0
  • CMSIS-Core V5.5.0 -> v6.4.0 (vendored headers had no local changes; libowlprg.a disassembly unchanged)

Gen / Faust

  • GenParameterMap.h: optional map of gen~ parameter names to OWL parameters, with stepped (GEN_SCALE_INT) and exponential (GEN_SCALE_LOG) scaling
  • Gen output map (GEN_OUTPUT_MAP) with optional bipolar outputs
  • Faust [scale:log] widgets; up to 48 Faust widgets (was 20); PatchMetadata up to 40 parameters (was 20)
  • genlib spline6_interp
  • Fixed Gen parameter defaults given in gen~ units instead of 0..1 (included here because the scaling features build on it)

Tests

  • LibSource unit tests for 14 test patches (DcBlockingFilter, ExponentialDecayEnvelope, IntArray, oscillators, NoiseGenerator, VelocityCurve, EnvelopeFollower, SmoothingFilter, DryWetProcessor, StateVariableFilter, VoltsPerOctave, AdsrEnvelope, SimpleValue, TakeoverValue)

HISTORY.md

Entries for every user-visible change above, newest first. Also adds the missing MidiMessage::at() entry to v23.1, where it shipped.

Verification

  • OWL2 and OWL3: make libs, then Template, CppTest, DaisySPTest, Gen and Faust patches build and link with arm-none-eabi-gcc 14.3.1
  • make tests passes

Deferred to the bug-fix/performance PR

  • Building without -fno-builtin / -mtune=cortex-m4, and CMSIS-DSP with ARM_MATH_LOOPUNROLL
  • LibSource block-loop locals and AdsrEnvelope block methods
  • TapTempo, WavetableOscillator, DcBlockingFilter and SmoothValue fixes (with their tests)
  • Web fast pow/log lookup tables; Faust FPU rounding builtins

Introduce the v3 Dockerfile (ubuntu 24.04, Arm GNU 13.3.rel1, FAUST 2.88.0,
emscripten 6.0.13, hvcc 0.17.3 via pipx (mainline), SOUL 1.0.82 frozen).

v3 revises v2's Dockerfile in place under the same filename — v1 -> v2 -> v3
are successive revisions of one Dockerfile, not parallel files. The owl.cpp
wrapper, web.mk and heavy.mk wiring land as follow-up axis edits.
- compile.mk: drop -ffreestanding from ARM C++ flags. GCC 13 forces
  __STDC_HOSTED__=0 under it, making libstdc++ <cmath>/<algorithm> hit
  bits/requires_hosted.h (hard error) + tr1 specfun templates referencing
  the absent std::__throw_domain_error. -nostdlib/-nostartfiles/-fno-builtin
  still yield the freestanding binary. Keep -D_GLIBCXX_USE_STD_SPEC_FUNCS=0.
- web.mk: emscripten 6 renamed EXTRA_EXPORTED_RUNTIME_METHODS ->
  EXPORTED_RUNTIME_METHODS; add -include stddef.h for DaisySP bare size_t
  under newer clang (interim; proper fix = DaisySP submodule bump).

Result: full OWL2 libs + patch build links cleanly under arm-gcc 13.3.1
(patch.bin produced). No linker-script changes were needed.
- heavy.mk: call `hvcc -g owl` (python3, mainline 0.17.3) instead of
  python2.7 Tools/hvcc + build_send_receive_constants.py; map c2owl output
  names (HeavyOwlConstants.h, HeavyOWL_owl.hpp) to the OWL build's expected
  Heavy_owl_constants.h / HeavyPatch.hpp. Crucially do NOT copy the fork's
  HeavySource/HvUtils.h over the generated output — mainline hvcc emits its
  own newer HvUtils.h (376 lines) defining the scalar hv_shl_i/hv_rint_f its
  HvMath.h needs; the fork's 352-line one lacks them.
- compile.mk: ARM HEAVY build defines HV_SIMD_NONE=1 (HvUtils only force-sets
  it when a SIMD macro is already truthy, else auto-detects and drops the
  scalar helpers); dropped the bogus -D__unix__ for ARM.
- MidiMessage.h: add at() poly-aftertouch factory required by c2owl's wrapper
  (MidiMessage::at for [polytouchout]).

Verified: HeavyTest.pd -> linked ARM .bin on OWL1/OWL2 (21052B) + OWL3 (18148B).
- link final module with em++ (not emcc) so the C++ runtime (operator new,
  __cxa_guard_*) is pulled in — emcc 6 no longer links it for C++ objects.
- export HEAPF32/HEAP32/HEAPU8 in EXPORTED_RUNTIME_METHODS — emscripten >=3.1
  stopped exporting the heap views by default, but WebSource/webaudio.js
  accesses them directly, so the web player needs them.

Verified: FreeVerb wasm output BIT-IDENTICAL between v2 (emcc 2.0.10) and v3
(emcc 6.0.13), driven through Node with mid-range params.
- pin the base image to linux/amd64: the ARM GNU 13.3.rel1 cross-compiler and
  SOUL binaries are fetched as x86_64, so the build runs amd64 (under Docker
  Desktop emulation on arm64 hosts), consistent with develop/v2.
- add a PLATFORM build-arg and pre-build the libs into the image.
- document the submodule-init requirement at COPY: the build context must have
  submodules checked out first, else an empty DaisySP breaks 'make libs'.
- add the BuildKit check-skip directive to silence FromPlatformFlagConstDisallowed
  (the amd64 pin is intentional).
- shallow-clone emsdk 6.0.13 at its tag (--depth 1 --branch) instead of the full
  repo history.
The C/C++ CI workflow was failing on every branch at 'Setup python' because
GitHub-hosted runners no longer provide Python 2.7. Update it to the v3
toolchain and modern actions:

- arm-none-eabi-gcc: fiam@v1 10-2020-q4 -> carlosperate@v1 13.3.Rel1
- emsdk: setup-emsdk@v7 2.0.10 -> @v14 6.0.13
- python: setup-python@v2 2.7 -> @v5 3.x, plus pipx install hvcc for make check
- checkout@v2 -> @v4, submodules: recursive
Point the Heavy PATCHFILE at c2owl's native HeavyOWL_owl.hpp instead of
renaming it to HeavyPatch.hpp, and drop the two cp lines in heavy.mk. The
generated wrapper #includes its own sibling HeavyOwlConstants.h, so no
header needs renaming.

Remove the now-dead fork-era hvcc files superseded by mainline hvcc 0.17.3
(-g owl / c2owl):
  - Tools/hvcc submodule (pingdynasty py2.7 fork)
  - Tools/HeavyPatch.tpl.hpp, Tools/Heavy_owl_constants.tpl.h
  - Tools/build_send_receive_constants.py
  - compile-heavy.sh
and the stale 'pip install -r Tools/hvcc/requirements.txt' in the check target.

Verified: HeavyTest.pd builds to a byte-identical patch.bin (21052 B) with
no rename artifacts produced.
…pe, IntArray and basic oscillators

Add TestPatch-style unit tests (TestPatches/*TestPatch.hpp) for LibSource
classes that previously had no test coverage. Each test runs natively via
'make tests' and on device, following the existing SmoothValueTestPatch
convention. Assertions are derived from the classes' documented behaviour and
example patches rather than their implementation:

- DcBlockingFilter: DC removal, step-edge pass-through, zero-mean preservation,
  time-constant accessors, reset, and block/stereo overload equivalence.
- ExponentialDecayEnvelope: trigger/gate levels, monotonic decay to zero,
  decay-time ordering, level accessors, sample-rate scaling.
- IntArray: create/clear, setAll, element-wise add, saturating shift, subArray
  aliasing, and 1.31 float round-trip.
- Basic oscillators (Ramp, InvertedRamp, Triangle, SquareWave): documented
  output ranges and shapes, pulse width, frequency/phase accessors, reset, and
  block == per-sample generation.
…thing and dry/wet

Extend TestPatch-style LibSource coverage to five more previously-untested
classes. Assertions follow the documented behaviour and example patches, not
the implementation; all run natively via 'make tests' and on device.

- NoiseGenerator (White/Pink/Brown): documented output ranges, approximately
  zero-mean white noise, non-constant output, and block-fill within range.
- VelocityCurve: unity gain at full velocity, monotonic rise, the documented
  gain = velocity^2/127^2 square law, and wider dynamic range attenuating low
  velocities more.
- EnvelopeFollower: rectified non-negative output, settling to a constant
  amplitude, intensity ordering, smoothed step response, block == per-sample.
- SmoothingFilter: convergence to a constant input, gradual (1-lambda) step
  response, slower smoothing for larger lambda, and overload/in-place agreement.
- DryWetSignalProcessor: mix=0 dry, mix=1 wet, mix=0.5 average, and mix accessor
  round-trip, using a trivial doubling processor as the wet path.
…nd TakeoverValue

Extend TestPatch-style LibSource coverage to five more previously-untested
classes, with assertions derived from the documented behaviour and example
patches; all run natively via 'make tests' and on device.

- StateVariableFilter: low/high/band-pass responses verified by driving tones
  above/below cutoff and comparing output RMS, plus reset clearing state.
- VoltsPerOctave: 1V/octave tuning (0V=440Hz, +1V doubles), equal-temperament
  note<->hertz, offset/multiplier sample conversion, tune/MIDI-note shifts, and
  conversion round-trips (two-arg ctor avoids the hardware service call).
- AdsrEnvelope (linear + exponential): attack rise, settling at sustain under
  gate, release decay to zero, sustain-level ordering, level accessors.
- SimpleValue: get/update/reset and the =, +=, -=, *=, /= operators plus
  implicit conversion, for both float and int specialisations.
- TakeoverValue: soft-takeover lock blocking far updates, unlock when within
  threshold, manual unlock, and lock-aware relative updates.
… ids

A gen~ export can only reach an OWL parameter if its parameter is named
A..H, AA..HH or Exp. Exports of existing patches (here Max Bruckert's
GEN-patches, used by owl-gen-patches) have descriptive names that we
should not edit in the Cycling '74 export. An optional GenParameterMap.h
in PATCHSOURCE now lists {gen~ name, PatchParameterId} pairs; mapped
parameters keep their gen~ name when registered. Without the header,
nothing changes.

Loop-Session: cycle1-worker3-uwmgjh65
GenParameter::update() maps the patch parameter (0..1) to the gen~
parameter's min..max, but the constructor passed the gen~ default
unscaled to setParameterValue(). A parameter with a range other than
0..1 started at the wrong value: shape (-1..1, default 0) started at -1,
steepness (0.5..10, default 4) at 10 (16380 of 4095). Normalise the
default with the same min/max.

Loop-Session: cycle1-worker3-uwmgjh65
…G in GenParameterMap.h

A frequency or rate knob over two or three decades (a filter cutoff of
20..20000 Hz) is unplayable with a linear response: the default 1200 Hz
sits at 6% of the travel. Both routes need the same response so that a
knob gives the same value on the Faust and Gen builds of a model.

- FaustSource/owl.cpp: an input widget with [scale:log] (as Faust's own
  UIs read it) maps the 0..1 parameter to lo * (hi/lo)^v when 0 < lo < hi;
  its default is set with the inverse.
- GenSource/GenPatch.hpp: GenParameterMapping takes an optional third field,
  GEN_SCALE_LINEAR (default) or GEN_SCALE_LOG, with the same mapping on the
  export's min..max. Existing maps of two fields are unchanged.

Loop-Session: cycle2-worker1-5s922x0x
A gen~ export that compares a parameter with integers (a menu: shape == 0,
1, 2, else the last entry) almost never matches on an OWL: GenParameter maps
the 12-bit knob (n/4096) linearly to min..max, so every position but the
bottom gives a fraction and the last entry, and an integer default (1 of
0..3) loads as 0.99976. owl-gen-patches' pulsar-synth (wave_shape, win_type)
and ufo (lfosel and three switches) have such menus; its Faust route
quantizes them by hand as min(N-1, floor(v * N)).

GenParameterMapping takes an optional fourth field, the number of steps:
{"shape", PARAMETER_E, GEN_SCALE_INT, 4} maps the 0..1 parameter to
min + k * (max-min)/(steps-1), k = floor(v * steps) clamped to steps-1, so
each value gets an equal share of the knob and the top gives max, the same
entries at the same positions as the Faust route. steps 0 (the default)
takes max-min+1, the integers of an integer range. The default is set at
k/(steps-1) of its nearest step, inside that step's share, so it loads
exactly. Mappings without GEN_SCALE_INT are unchanged.

Loop-Session: cycle6-worker2-a2g53zhd
OwlUI collects at most MAXOWLPARAMETERS (20) mappings between Faust
widgets and OWL parameters, buttons and outputs, and silently drops the
rest: they keep their Faust default and have no knob. owl-gen-patches'
aether-particle has 23 parameters (ids A..E, AA..AH, BA..BH, CA, CB): its
last three in registration order, r_size, r_speed and r_tilt, were never
registered on the Faust route, while the Gen route (GenPatch) registers
all 23. The firmware has 40 parameters (NOF_PARAMETERS) and 8 buttons;
allow as many mappings. The table is 48 pointers instead of 20.

Loop-Session: cycle6-worker2-a2g53zhd
… (GEN_OUTPUT_MAP)

Reason: owl-gen-patches PH4 adapts the gen~ exports with more than one output per audio
channel (bernoulli-gate 1/3, poisson-cloud 2/3, cswitch-tremolo 2/4) to the OWL's 2 in / 2 out.
Without a map, GenPatch sends out1, out2 to the audio channels and the rest to F, G, ... as
block means, so a counter landed on an audio output and a one-sample trigger averaged to
nearly 0. The map routes each output to an audio channel (summed), an output parameter
(the block mean, optionally divided by a gen~ parameter) or a gate output (high for the
block when its maximum is over 0.5). Without GEN_OUTPUT_MAP nothing changes.

Loop-Session: cycle7-worker3-iksqoeuh
…9's genlib

Max 9 exports with interp mode "spline6" (faust-gen-patches offset-spline-random) call
spline6_interp, which OwlProgram's older genlib lacks, so their Gen route did not compile.
The function is Max 9's genlib_ops.h verbatim (MIT, Cycling '74); nothing else changes.

Loop-Session: cycle8-worker3-w5sjyshw
… parameter as (x + 1) / 2

An output parameter (F, G: a CV out) is 0..1, so a bipolar output (lorenz-rossler-chaos's z,
offset-spline-random's spline walk) lost its negative half (owl-gen-patches issue 41230a9f, D65).
The flag defaults to false: existing maps are unchanged.

Loop-Session: cycle9-worker1-x34dx1v4
The OWL server's patch builder (OwlServer web/scripts/patch-builder/patch-builder.php) writes
Source/metadata.h with every float parameter of the patch record, ids 0..39 (A..DH, the
server's availableParameterIds), with no limit on their number. PatchMetadata::parameters is
declared with NOF_PARAMETERS (20) elements, so a Gen patch (GenPatch.hpp includes metadata.h)
whose record lists more than 20 parameters fails to compile: 'too many initializers for
const PatchMetadata::Control [20]' (arm-none-eabi-gcc), 'excess elements in array
initializer' (native). owl-gen-patches' aether-particle has 23 (ids up to CB).

40 is the number of PatchParameterIds (A..DH) and of the server's float ids. Shown by
owl-gen-patches tools/owlserver/compare.py aether-particle gen (native, the server's
metadata.h against the build without it) and an OWL2 patch.bin build with that metadata.h.

Loop-Session: cycle11-worker3-93rgi053
… to the map

With a metadata.h from the OWL server's patch builder (OWL_METADATA), GenPatch registers the
record's parameters and assigns its output parameters and buttons to the export's outputs
beyond the audio channels. An export with an output map (GEN_OUTPUT_MAP) has no such outputs
(nof_outs is 0): the map registers and routes them. A record that lists the map's output
parameters (so that the server's patch page shows them) then registered each one twice and
sent the debug message 'Output parameters not matching <n> 0' on every load.

With GEN_OUTPUT_MAP the metadata loop now skips the output parameters and the mismatch check;
the input parameters are registered from the record as before. Shown by owl-gen-patches
tools/owlserver/compare.py <model> gen for offset-spline-random, lorenz-rossler-chaos,
poisson-cloud and bernoulli-gate (before: double registrations and the message; after: the
same registrations, defaults and first block as the build without metadata.h).

Loop-Session: cycle11-worker3-93rgi053
From ARM-software/CMSIS-DSP v1.18.0 (was V1.10.0, CMSIS 5): Include,
PrivateInclude, Source, README.md, LICENSE. The sources now need
DSP/PrivateInclude on the include path. arm_bitreversal2.S is gone upstream;
build arm_bitreversal2.c instead.

All 120 test patches build as before on OWL2 and OWL3 (same 4 known
failures). Genius, cycles per block, 12 CMSIS-heavy patches (FFT, vocoder,
biquad, Faust, sine): unchanged within 0.06%.
From ARM-software/CMSIS_6 v6.4.0 (was Core(M) V5.5.0, CMSIS_5 develop
efd2b93c, byte-identical to upstream: no local changes). Core/Include
replaced wholesale, adds m-profile/, a-profile/, r-profile/; drops
cmsis_armcc.h, cmsis_armclang_ltm.h, core_star.h (unreferenced). Adds the
upstream LICENSE.

OWL2 and OWL3: libs, Template, CppTest, DaisySPTest, Gen and Faust build
without new warnings. libowlprg.a disassembly identical. Only patch code
change is SampleBuffer32::comb (__SSAT is now the __ssat builtin instead
of volatile asm), 48-64 bytes smaller.
Drop the v3 modernization/axis notes (outdated FAUST and Emscripten versions, finished migration history) and comments restating the commands.
HeavySource/ (fork runtime HvMessage.c, HvUtils.h) was no longer used: mainline hvcc generates its own. Drop the unused HEAVYSRC variable and fork migration comments from heavy.mk.
checkout v7, setup-python v7, setup-emsdk v16, docker login v4, setup-buildx v4, build-push v7. arm-none-eabi-gcc release 'latest' and unpinned hvcc, so CI tracks upstream.
Silences ld's 'LOAD segment with RWX permissions' warning. Section placement is unchanged: patch .bin output is byte-identical on OWL2 and OWL3.
EXPORTED_FUNCTIONS, EXPORTED_RUNTIME_METHODS, WASM and ASSERTIONS were also given to every compile, which emcc warns about.
Emscripten wasm builds expose the heap views only on Module, not as globals. Module.HEAP* works with both the current WASM=0 build and wasm.
Tools/webtest.js loads Build/web/patch.js as webaudio.js does, runs WEB_setup and 200 audio blocks, and fails on abort, missing Module.HEAP32/HEAPF32, missing patch name, non-finite output or an error status. make check runs webtest instead of web for each test patch.
The view of input channel pointers was sized by the ins pointer value instead of the channel count, giving an oversized view.
Docker image and CI. make check (build and webtest for all test patches) passes; MIDI note on/off and audio output of a web patch verified headless.
node can deadlock in process.exit() on Linux (all threads in futex wait), which hung CI after 'webtest OK'. Set process.exitCode instead; process.exit(1) is only used if the runtime never initialises. In the Docker image: 27 of 30 runs hung before, 0 of 30 after.
-INFINITY is undefined behaviour under -ffast-math (-Wnan-infinity-disabled). Return early for an empty matrix.
Silences HvUtils.h 'Could not detect platform' warning. HeavyTest patch.bin is byte-identical.
With the emsdk root on PATH, make finds the emsdk node/ directory before the node binary (Permission denied).
Link emsdk's node into /usr/local/bin and drop the emsdk root from PATH (its node/ directory shadowed the binary for make). soul has no --version; use soul version.
@pingdynasty
pingdynasty force-pushed the feature/modernization branch from f6206e9 to 5c032f5 Compare November 27, 2026 20:12
@pingdynasty
pingdynasty merged commit 1fea1de into master Nov 27, 2026
1 check passed
@pingdynasty
pingdynasty deleted the feature/modernization branch November 28, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant