Нет описания

Johan Le Baut c9d79fe0f0 manage unexpected links 2 недель назад
amp_emul a28fb9f9f8 add amp emul files 2 недель назад
artifacts 479aca126f arm builder for sooperlooper et mod-host 2 недель назад
build 479aca126f arm builder for sooperlooper et mod-host 2 недель назад
config c9d79fe0f0 manage unexpected links 2 недель назад
scripts c9d79fe0f0 manage unexpected links 2 недель назад
tests c9d79fe0f0 manage unexpected links 2 недель назад
.dockerignore 479aca126f arm builder for sooperlooper et mod-host 2 недель назад
.gitignore 5a7cbdfa6a config mix 2 недель назад
AGENTS.md c9d79fe0f0 manage unexpected links 2 недель назад
README.md c9d79fe0f0 manage unexpected links 2 недель назад

README.md

Rigforge

Scope

Rigforge is a standalone Raspberry Pi audio pedalboard. The desired routing is described in config/desired-state.yaml. Hardware-specific ports and operational settings remain provisional until tested on the target.

Current target observations

The current target reports Debian GNU/Linux 13.7, AArch64, and a Behringer UMC404HD 192k. ALSA advertises four capture and four playback channels. PipeWire 1.4.2 and WirePlumber are active in the logged-in jojo user session, with Linger=no.

PipeWire exposed four capture channels named capture_AUX0 through capture_AUX3 and four playback channels named playback_AUX0 through playback_AUX3. A four-channel 48 kHz recording was completed, with the guitar on physical input 1 appearing on capture_AUX0 and the microphone on physical input 3 appearing on capture_AUX2; the other channels were at noise floor during that test. A temporary PipeWire link from capture_AUX0 to playback_AUX0 produced audible guitar. The target owner reports that playback_AUX0 feeds output 1L and that Main Out L receives 1L with MIX set to PB and MONITOR set to A. The owner then added capture_AUX2 and confirmed hearing both guitar and microphone with a 128-frame quantum at 48 kHz; this is an initial successful low-latency listening test, not yet a sustained dropout or headroom measurement. Monitoring duplication, clipping headroom under summed sources and loop returns, and MIDI/OSC behavior have not yet been tested.

The target has aconnect, amidi, and oscsend; ALSA lists the UMC404HD MIDI port. This does not yet verify FCB1010 messages or SooperLooper OSC availability. amixer -D hw:2 scontents showed capture and playback controls at 0 dB; no mixer settings have been changed.

Target preparation recorded so far

Before collecting the target observations, the following commands were run on the current Raspberry Pi OS Lite installation:

sudo apt update
sudo apt upgrade
sudo apt install --no-install-recommends \\
  rtkit pipewire pipewire-jack wireplumber \\
  libspa-0.2-modules liblo-tools git \\
  librubberband2 lilv-utils libcairo2 

This records the preparation already performed on rigforge and is a starting point for documenting a second Pi. It is not yet a verified, version-pinned rebuild procedure: package versions, additional runtime dependencies, audio configuration, and service setup still need to be confirmed before reusing it as a complete deployment recipe.

Repository layout

  • config/desired-state.yaml: versioned desired audio topology and provisional target mapping.
  • config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf: tested filter-chain node configuration for the four-input mono direct mixer.
  • config/sooperlooper/fcb1010.slb: supplied FCB1010 binding file, pending on-target verification.
  • build/arm64/: shared ARM64 build image and task scripts for SooperLooper and mod-host.
  • scripts/validate_desired_state.py: validates topology and routing invariants without changing the target.
  • scripts/observe_pipewire.py: read-only comparison by default, with explicit one-shot repair for declared missing links.
  • scripts/deploy.sh and scripts/deploy.py: scoped user-level installation, removal, and reload of declared PipeWire and LV2 plugin bundles.
  • tests/: unit tests for desired-state validation, PipeWire observation/reconciliation, and deployment operations.
  • artifacts/sooperlooper/arm64/ and artifacts/mod-host/arm64/: generated binaries, runtime dependency reports, and build provenance; commit after reviewing licensing and repository size.

The YAML describes desired state; a control surface is not a second source of truth. The initial audio profile declares 48 kHz and a quantum of 128 frames, which was reported to sound good during a temporary target test. At 48 kHz, 128 frames is about 2.7 ms per period, not the end-to-end latency. This runtime value has not yet been made persistent or measured under sustained load; apply it temporarily on the target with pw-metadata -n settings 0 clock.force-quantum 128 and return to automatic selection with pw-metadata -n settings 0 clock.force-quantum 0. Concrete PipeWire ports, buffer settings, package names, services, and artifact installation path will only be recorded as verified after target tests.

Validate the desired-state file on the development PC with:

python3 scripts/validate_desired_state.py
python3 -m unittest discover -s tests -v

The validator checks that there are four distinct physical inputs, one four-channel looper with each source assigned once, a declared mix output, and no active or planned route from looper returns back to looper inputs. It is read-only and does not connect audio ports or modify the target.

For an initial read-only graph observation on a system with pw-link, run:

python3 scripts/observe_pipewire.py

The observer reads pw-link -l and compares only connections whose endpoints are explicitly listed under routing.managed_ports; expected edges go in routing.managed_links. Exact obsolete edges that may be removed by explicit reconciliation must be separately listed under routing.managed_unlinks. The current YAML declares the three guitar NAM/cabinet edges, the voice mixer edge, the mixer output edge, and the obsolete direct guitar bypass for removal. WirePlumber's unrelated hardware links remain outside project management. The default command only reports differences and never changes the graph; declared removals appear as would-unlink, while all other unexpected links remain would-review.

An explicit one-shot mode can create missing declared links after checking that the source and destination ports exist, then remove only present links explicitly declared in routing.managed_unlinks:

python3 scripts/observe_pipewire.py --reconcile-once

This mode never removes an unlisted link, changes undeclared connections, or restarts services. It attempts declared additions first and removes explicitly listed stale links only after every desired managed link is visible; if any desired link remains missing, removals are deferred. It then re-reads the graph and reports remaining differences. Use it only during a safe test window: repaired or removed links can immediately change audible routing. Unit tests use simulated pw-link results.

On 2026-11-18, the target owner deliberately removed the managed AUX2 capture-to-mixer link during a safe test. Observation reported that single link as missing. After updating rigforge to commit 83fb0a7, --reconcile-once requested the link, and the final check reported differences: []. A subsequent read-only observation also reported no differences, the microphone was confirmed audible again, and all 20 unit tests passed on the target. In a later target test, restarting filter-chain.service removed all three managed links; explicit --reconcile-once requested all three, and the final observer again reported differences: []. Audio audibility after this later repair was not reported. These tests verify one-shot repair on the current target, not continuous reconciliation or recovery when ports are unavailable. After any filter-chain service restart, run the read-only observer and, during a safe test window, explicitly reconcile if links are missing.

Candidate direct mix test

config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf defines a PipeWire builtin mixer with four mono inputs, a single mono output, and an initial gain of 0.2 per input. It was loaded on rigforge; its input and output nodes appeared in the graph. Manual links from capture AUX0 and AUX2 through mixer input ports AUX0 and AUX2 to playback AUX0 produced audible guitar and microphone together. Inputs 2 and 4 are provisioned but remain untested with instruments.

The installed PipeWire example documents loading fragments from ~/.config/pipewire/filter-chain.conf.d/ with pipewire -c filter-chain.conf, which is the command used by the current user service. The fragment was installed and tested in that user configuration without editing /etc or the packaged config:

target="$HOME/.config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf"
backup="$target.before-rigforge-test"
mkdir -p "$(dirname "$target")"
if test -e "$target"; then
    cp -a "$target" "$backup"
fi
install -m 0644 config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf "$target"
systemctl --user restart filter-chain.service

The test has already been performed on rigforge: filter-chain.service was active and exposed input ports rigforge.direct-mix.input:playback_AUX0 through playback_AUX3 and output port rigforge.direct-mix.output:capture_FL. The three links now declared in YAML were connected manually with pw-link; guitar on input 1 and microphone on input 3 were heard together through the mixer. Existing WirePlumber hardware links were left untouched.

Rollback the fragment and reload the filter service after the test:

if test -e "$backup"; then
    mv "$backup" "$target"
else
    rm -f "$target"
fi
systemctl --user restart filter-chain.service

This restarts only filter-chain.service, not the main PipeWire daemon. The fragment and three links have passed an initial target listening test, but the test is not a sustained load, dropout, four-instrument, or headroom test. If activation or sound behaves unexpectedly, first remove the test links, perform the rollback, verify the filter service is active, and do not repeatedly restart it. Repository tests check channel/gain declarations and observer comparisons; they do not replace target runtime measurements.

User-level deployment on rigforge

After a manual git pull --ff-only, run the deploy helper from any directory:

~/rigforge/scripts/deploy.sh install pipewire
~/rigforge/scripts/deploy.sh install namlv2
~/rigforge/scripts/deploy.sh install lsp
~/rigforge/scripts/deploy.sh install dragonfly-reverb
~/rigforge/scripts/deploy.sh install mod-host
~/rigforge/scripts/deploy.sh install all

The helper accepts install|uninstall|reload and all|namlv2|lsp|dragonfly-reverb|pipewire|mod-host. It reads versions, paths, URLs, and quantum from config/desired-state.yaml; its deployment registry is stored under ~/.local/state/rigforge/, and any pre-existing target backup is stored next to that target. It does not use sudo or change files outside the declared paths, adjacent backup paths, and registry directory.

For PipeWire, install updates only the Rigforge filter fragment, applies the declared quantum as a runtime setting, and restarts filter-chain.service only when the fragment changes. It never restarts pipewire.service or WirePlumber. reload pipewire reapplies the quantum and restarts the filter-chain user service. This restart removes the filter-chain nodes and their graph links; the fragment recreates ports but not links. The deploy helper deliberately does not reconcile links automatically. After a restart, first run python3 scripts/observe_pipewire.py; if declared links are missing, use python3 scripts/observe_pipewire.py --reconcile-once only during an appropriate safe test window, then observe again. Uninstall removes only the unchanged managed fragment, restores a file that was present before the first install, returns quantum selection to automatic, and reloads the filter service. Local edits to managed files stop removal or replacement rather than being discarded. Runtime quantum is not persistent across a PipeWire daemon restart.

For NAM LV2, install downloads the declared Raspberry Pi 5 archive with curl, checks the archive structure, extracts the neural_amp_modeler.lv2 bundle under ~/.lv2/, and records the archive SHA-256 and managed bundle fingerprint. This is a locally computed identity hash, not an independent publisher checksum. An existing same-name bundle is preserved for uninstall; locally modified managed bundles are not overwritten or removed. reload namlv2 does nothing because plugin installation itself requires no host reload; restart mod-host after installing or removing the plugin. On the target, tag v0.2.3 was installed at ~/.lv2/neural_amp_modeler.lv2; the observed contents were manifest.ttl, modgui/, modgui.ttl, neural_amp_modeler.so, and neural_amp_modeler.ttl. The downloaded archive SHA-256 was 80d1a711d573afb7323cbf2ea1a79e39386e58ba449d076c5d89e10b50de3212; this is an identity hash only, not an independent publisher checksum. The selected NAM model was loaded during the initial manual mod-host chain test; sustained performance and automated startup remain unverified. The release archive is fetched at install time and is not committed to this repository.

For LSP and Dragonfly Reverb, the YAML declares tags and release URLs, and the installer places only LV2 bundles in ~/.lv2/. LSP installs lsp-plugins.lv2; Dragonfly installs its Early Reflections, Hall, Plate, and Room Reverb bundles. LSP extraction requires 7z, 7zz, or 7za on PATH, with support for the compression methods used in the release; install or update that system package separately if needed. A listing or extraction error aborts the install before any bundle is changed. The installers hash archives for identity tracking, check archive paths and expected manifests, preserve existing same-name bundles for uninstall, and refuse to remove locally modified managed bundles. reload lsp and reload dragonfly-reverb do not restart an LV2 host; restart the host after installation or removal. The LSP mono impulse-response plugin was instantiated and used in the initial manual chain test; its libcairo2 dependency is included in target preparation. Other LSP plugins and Dragonfly runtime dependencies remain unverified on target.

mod-host guitar chain

install mod-host is an explicit target and is deliberately not included in install all: it activates the guitar processing chain. It requires the ARM64 artifact under artifacts/mod-host/arm64/current/, the NAM and LSP bundles already installed, the tracked amp_emul/ assets, and the runtime packages in the target preparation list. It installs and enables a systemd --user unit; it does not use sudo or restart PipeWire/WirePlumber. The generated unit refers to the repository checkout from which deploy.sh was run, so keep the checkout at that path or uninstall/reinstall after moving it.

At service startup, scripts/configure_mod_host.py waits for the control socket, loads the declared NAM and LSP mono-IR instances, sets their model/IR paths and the conservative NAM output level, then creates the PipeWire links. The desired chain is capture AUX0 → Vox_AC15CH_Crunch_TB.nam → VOX_AC30_1964_celestion.wav → guitar mixer input AUX0. The direct capture-to-mixer bypass is removed. Review the model and IR redistribution terms before using these assets in a public image or package.

reload mod-host restarts the service and rebuilds the plugin graph, briefly interrupting the processed guitar path. uninstall mod-host disables/stops the unit and restores any prior unit file; it does not create a dry bypass. The mod-host control socket uses TCP port 5555 and this build listens on 0.0.0.0 without authentication. This is retained for the current test by owner request and must be restricted before treating the setup as hardened.

The owner reports enabling lingering with sudo loginctl enable-linger "$USER" so the user manager can run without an interactive login. Automatic boot startup and recovery after PipeWire restarts still require on-target verification. Installation refuses to start if port 5555 is already occupied by an unmanaged/manual mod-host process; stop that process explicitly before retrying.

Inspect the service after installation with:

systemctl --user status rigforge-mod-host.service
journalctl --user -u rigforge-mod-host.service -b

On the target, install pipewire applied quantum 128 and reported that the installed fragment was already current; the following observer reported no differences. A later reload pipewire applied the quantum and restarted the filter-chain service, after which observation found all three managed links missing. One-shot reconciliation requested each link, and the subsequent observer reported differences: []. This confirms the graph links were present after reconciliation, not that audio was audible. install all and uninstall all attempt all four targets and report an overall failure if any action fails. reload all restarts the filter-chain service and prints no-op messages for the LV2 plugins. Check the target afterwards with python3 scripts/validate_desired_state.py, python3 -m unittest discover -s tests -v, and python3 scripts/observe_pipewire.py.

Development PC

The development host can be Ubuntu AMD64 or WSL2 with Docker Buildx and ARM64 emulation available. The shared image under build/arm64/ uses Debian 13 ARM64 tools. Source URLs and tags are declared in config/desired-state.yaml and validated before either build. SooperLooper uses v1.7.9-mods.1, resolving to 946b92e342bfb31c731671463995d31daf79fc0e; mod-host uses v1.15.0.3371, resolving to 956e13e538a440a6ee87fd350e6b510ec5e7a1b6.

Build the common image once from the rigforge repository root, then select a build task:

docker buildx build --platform linux/arm64 --load -f build/arm64/Dockerfile -t rigforge-arm64-build:debian13 .
docker run --rm --platform linux/arm64 --user "$(id -u):$(id -g)" -v "$PWD:/workspace" rigforge-arm64-build:debian13 sooperlooper
docker run --rm --platform linux/arm64 --user "$(id -u):$(id -g)" -v "$PWD:/workspace" rigforge-arm64-build:debian13 mod-host

Use task all to build both programs in sequence. The shared image contains the union of their compiler dependencies; each task retrieves the source tag from YAML, records the resolved commit, builds only its target, checks runtime dependencies, hashes the binary, and writes its executable, runtime-dependencies.txt, and provenance.json under artifacts/<project>/arm64/current/. The build checks that it is running in an ARM64 Debian container. Each successful task replaces only its own prior output, and staged output is removed on failure. Run the container with the host UID/GID as above so generated files remain accessible to the host user. To update a source version, change its deployment.sooperlooper.tag or deployment.mod_host.tag, validate the YAML, then rerun the task. Buildx --load for one ARM64 platform and docker run --platform linux/arm64 need binfmt/QEMU on AMD64 hosts.

SooperLooper's tagged source does not define ARM64 atomics in libs/pbd/pbd/atomic.h or src/atomic.h; the build task injects GCC __atomic operations for AArch64 in its temporary clone, leaving the upstream source repository untouched. This local portability patch is recorded in provenance. The image only compiles; it does not deploy or run either program on the Pi. Successful compilation does not establish runtime compatibility: inspect dependencies and test on the target. Review upstream licenses and artifact size before committing generated binaries and provenance.

rigforge target

The filter-chain fragment is installed in the user configuration on rigforge, and filter-chain.service was restarted to load it. The user confirmed guitar and microphone are audible together through the filter. The guitar now has a tested NAM → cabinet-IR chain before mixer AUX0; the owner reported a pleasing crunch and no crackle during the initial listening test. The direct guitar bypass link is absent while the mod-host chain is connected. This is not a sustained load, dropout, headroom, or unattended-startup test. A brief mod-host CPU-load reading was about 42%; one pw-top snapshot showed no reported errors but does not establish stability.

The next target checks are:

  1. The read-only observer and one-shot repair have been tested on rigforge. Repairing one missing link restored the audible microphone path; after a later filter-chain service restart, reconciliation requested all three missing links and the observer reported no differences. The observer now also tracks the three guitar NAM/cabinet links. Do not run one-shot reconciliation against an older checkout: it could restore the dry guitar bypass.
  2. Later, test inputs 2 and 4 with sources when available; they are included in the mixer but not verified with instruments.
  3. Measure sustained stability and headroom at 48 kHz / 128 frames with all active sources; the current ERR = 0 observation was brief.
  4. Verify the new rigforge-mod-host.service on the target, including reboot with lingering enabled, PipeWire restart behavior, resource limits, and recovery when an LV2 plugin fails to load.
  5. Verify FCB1010 MIDI messages and the supplied bindings with the eventual SooperLooper build. Verify OSC port readiness and the effect and persistence of discrete_prefader 0 separately.

Do not treat planned packages, commands, ports, or service settings as target-validated until these checks have been performed.

Deployment and rollback

Deployment is manual: inspect and test a change, then use git pull on rigforge only when the change is ready. No CI/CD or auto-pull is configured. The mod-host service unit and deploy commands are now declared in the repository, but installation/activation, logs, diagnostics, and rollback remain unverified on the target. Keep the last known working revision available; do not apply unverified audio or service changes during live use.