Search guides and the APICtrl K
  1. API reference
  2. DSP

simd.h

SIMD.

#include <sonore/simd.h>
On this page

Design notes

One type, Vec4f: four floats processed together. 128-bit / 4-wide is the common denominator of every target we ship to: SSE2 on x86-64, NEON on Apple Silicon and ARM Windows, and simd128 in WebAssembly. Picking the widest available instead (AVX, AVX-512) would mean a different vector width per platform, and the browser preview would stop matching the shipped plugin in the one dimension this SDK exists to keep identical.

WebAssembly matters here as much as native: the same DSP runs in the studio preview, and a toolkit that is only fast natively makes the preview the slow path for no reason. emscripten needs -msimd128; without it this header falls back to scalar and everything still works.

The scalar fallback is not a stub. It is compiled whenever no vector unit is available, and SONORE_NO_SIMD=1 selects it deliberately, which is how the tests prove the vector paths produce the SAME NUMBERS as the plain ones. A SIMD layer that changes the sound is a bug, not an optimisation.

Types 1

Four floats, one operation.

Deliberately a small, boring surface: load, store, arithmetic, min/max, and a horizontal sum. Everything the toolkit needs is expressible in those, and a bigger surface would be more per-platform code to get subtly wrong.

Functions 8

Macros 2

  • macro#define SONORE_SIMD_NEON 1
    MSVC on Windows on Arm defines _M_ARM64 and NOT the ACLE __ARM_NEON, so without that last test cl.exe fell through to the scalar path: correct, identical numbers, and every block helper running at a quarter of its speed on exactly the machines that ship NEON in the base architecture.
    simd.h:36
  • macro#define SONORE_SIMD_SSE 1
    MSVC never defines __SSE2__; on x86-64 SSE2 is guaranteed by the ABI.
    simd.h:40
↑↓ to move↵ to openEvery public name in the headers, and every guide