TimbrAI audio libraries — rebuilding and replacement This document describes the NEW distribution candidate, not the original 0.9.50 runtime. All source archives are in sources/ and their SHA-256 values and original download URLs are in sources.json. No changes were made to the C sources of FFmpeg 8.1.2, LAME 4.0, lameenc 1.9.0 or PyAV 18.1.0. Build options changed. Build environment used: Apple Silicon, Xcode command-line tools, target macOS 14, Python 3.11.18, Cython 3.3.1, wheel 0.48.0, packaging 26.3, pkgconf 2.5.1. FFmpeg/LAME source archives and the exact setup/link commands are provided with build-scripts/. No private certificates or developer accounts are required to build these libraries. Ad-hoc signing is sufficient for a local replacement. FFmpeg ------ Unpack ffmpeg-8.1.2.tar.xz into a working directory. From that source directory: ./configure --prefix=../ffmpeg-install --install-name-dir=@loader_path \ --disable-autodetect --disable-gpl --disable-nonfree --disable-version3 \ --enable-shared --disable-static --disable-programs --disable-doc \ --disable-debug --disable-encoders --enable-encoder=pcm_s16le \ --disable-muxers --enable-muxer=wav --disable-devices --disable-network \ --extra-cflags=-mmacosx-version-min=14.0 \ --extra-ldflags=-mmacosx-version-min=14.0 make -j6 make install For downstream compilation, use the absolute path to ffmpeg-install as the prefix in its lib/pkgconfig/*.pc files. No GPL/nonfree external libraries are enabled. The supplied scripts copy the seven shared libraries and their version symlinks into Runtime/site-packages/av/.dylibs/ and sign the copied binaries ad hoc. PyAV ---- Use the provided av-18.1.0 source archive. Install Cython 3.3.1, wheel 0.48.0 and packaging 26.3 into an isolated build-tool environment. Set PKG_CONFIG_PATH to the above ffmpeg-install/lib/pkgconfig directory. Set MACOSX_DEPLOYMENT_TARGET=14.0. Using Python 3.11: python3.11 -m pip wheel ./av-18.1.0 --no-deps --no-build-isolation --wheel-dir ./wheels Install the resulting wheel in a copy of Runtime/site-packages/. Apply the install_rebuilt_pyav.py relocation procedure: each FFmpeg dependency must resolve relative to that extension's directory to av/.dylibs/. The script only changes Mach-O load paths and signatures, not source code. Re-sign changed extensions. LAME and lameenc --------------- Unpack lame-4.0.tar.gz. Configure from its source directory, using an ABSOLUTE path for and the actual path to pkgconf for : ./configure --prefix= --enable-shared --disable-static \ --disable-frontend --disable-decoder --disable-nasm --disable-analyzer-hooks \ PKG_CONFIG= CFLAGS='-O2 -fPIC -mmacosx-version-min=14.0' \ LDFLAGS='-mmacosx-version-min=14.0' make -j6 make install Unpack lameenc-1.9.0.tar.gz. Unlike the upstream wheel's static linkage, this candidate builds lameenc.c as a Python extension dynamically linked to LAME. See install_lgpl_lame.py for the exact clang command, Python include paths and install_name_tool invocation. The library's install name is: @loader_path/lameenc-libs/libmp3lame.0.dylib The extension stays at Runtime/site-packages/lameenc.cpython-311-darwin.so. LAME stays at Runtime/site-packages/lameenc-libs/libmp3lame.0.dylib. Replacing libraries in an installed copy ---------------------------------------- 1. Finish your work and close your own TimbrAI instance normally. 2. Back up the engine directory selected in TimbrAI's storage settings. 3. Replace the relevant libraries/extensions with ABI-compatible arm64 builds in the paths described above. Keep the library names and relative load paths. 4. Apply `codesign --force --sign - ` to each changed Mach-O file. 5. If your engine is enclosed in an application bundle, re-sign that enclosing engine bundle ad hoc after changing its contents. Do not change system-wide Gatekeeper settings. Replacing the engine does not require replacing TimbrAI's own UI code. A production engine's Python must permit loading user-rebuilt libraries. The supplied python-library-replacement.entitlements enables com.apple.security.cs.disable-library-validation for the Python executable only. Keep this entitlement when signing that executable for distribution. Loading the replacement libraries was tested with Hardened Runtime enabled and an ad-hoc signature. Repeat the test after final Developer ID signing. 6. Run the supplied WAV/MP3 encoding and decoding smoke test, then reopen TimbrAI. Installer checksums protect the downloaded original archive. They are not a license restriction on modifying an installed library. The app's current installer stores the verified archive hash separately and does not compare individual installed library hashes on every launch. SciPy / GCC provenance --------------------- The candidate replaces SciPy's inherited libgfortran, libgcc and libquadmath with the corresponding three libraries from the SHA-256-pinned Homebrew GCC 13.4.0 arm64_sonoma bottle. The GCC source archive is in sources/gcc-13.4.0.tar.xz. The exact formula extracted from that bottle, its source SBOM, the GCC Darwin patch and provenance records are in build-scripts/gcc13/. Apply ONLY gcc-13.4.0-bottle.diff to that GCC source tree. Follow bottle-formula.rb for configure arguments, prerequisite build tools/libraries and the build/install steps. The patch is byte-identical to its initial publication in Homebrew's formula-patches repository and its later migration to homebrew-core. Do not use the current formula or later Darwin-version patches to reproduce this bottle. The source SBOM's creation timestamp is not used as proof of the bottle's build time; correspondence is based on the pinned bottle, its bundled recipe and the unchanged version-specific patch. install_documented_gcc.py records the only binary modifications: relocation of Mach-O load paths to @loader_path and ad-hoc signatures. No source code changed. The source and installed library hashes are in installed-libraries.json. All three libraries are separately replaceable in Runtime/site-packages/scipy/.dylibs/. Resampling and a LAPACK linear solve were checked with the replacement libraries.