diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 74b6a40fd..abeb9a38f 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -108,6 +108,7 @@ jobs: node --check site/preview-v2/assets/mixer-native-harmony.js python tests/native_harmony_assembly_test.py node --check site/preview-v2/assets/mixer-native-vocal-throw.js + node --check site/preview-v2/assets/mixer-native-sonku.js python tests/native_peq_assembly_test.py python tests/approved_operator_ux_smoke.py python scripts/build_ui_css.py --check diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d0a7b589..697e2a77c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ juce_add_binary_data(ARMixAssets SOURCES "${ARMIX_BRAND_DIR}/arsonmix-256.png") target_include_directories(ARMixConsole PRIVATE "${ARMIX_APPROVED_GUI_DIR}") -target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h engine/builtin_fx/HarmonyDsp.h engine/builtin_fx/HarmonyMusicKey.h engine/builtin_fx/ChannelHarmonyProcessor.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/AuxBusPlan.h engine/core/PreparedMixerBlock.h engine/core/MasterOutputMonoPolicy.h engine/core/LiveChannelFxGraph.h engine/core/PreparedNativeMixerSession.h engine/core/NativeDryRouteCommand.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/NativeFxParameterHotkey.h src/FactoryFxRegistry.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/NativeShowSchema.h src/NativeDryShowRecall.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/LiveSecondaryOutputDevice.h engine/core/LiveOutputRouteGate.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/JuceActivePortSnapshot.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h) +target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h engine/builtin_fx/HarmonyDsp.h engine/builtin_fx/HarmonyMusicKey.h engine/builtin_fx/ChannelHarmonyProcessor.h engine/builtin_fx/SonKuSpatialProcessor.h engine/builtin_fx/sonku/SonKuSpatialCore.h engine/builtin_fx/sonku/SonKuMeasuredHrir.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/AuxBusPlan.h engine/core/PreparedMixerBlock.h engine/core/MasterOutputMonoPolicy.h engine/core/LiveChannelFxGraph.h engine/core/PreparedNativeMixerSession.h engine/core/NativeDryRouteCommand.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/NativeFxParameterHotkey.h src/FactoryFxRegistry.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/NativeShowSchema.h src/NativeDryShowRecall.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/LiveSecondaryOutputDevice.h engine/core/LiveOutputRouteGate.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/JuceActivePortSnapshot.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h) # Explicit UTF-8 source decoding: native channel icons are Unicode, and # MSVC's machine-specific ANSI source charset corrupts emoji literals. # Limit the flag to C++ (not Windows .rc/resource compilation). @@ -198,6 +198,10 @@ if(BUILD_TESTING) add_test(NAME BuiltInFxUserPresetFourRealJuceAdaptersAndColdReopen COMMAND ARMixBuiltInFxAcceptedSnapshotTests) + # Native 8D-SonKu non-JUCE measured-HRIR PCM and deterministic orbit fixture. + add_executable(ARMixSonKuCoreTests tests/sonku_spatial_core_test.cpp) + target_compile_features(ARMixSonKuCoreTests PRIVATE cxx_std_20) + add_test(NAME NativeSonKuMeasuredBinauralDirectionalAndChunkParity COMMAND ARMixSonKuCoreTests) # Pure control-plane first-run routing selection: no JUCE, drivers, # WASAPI activation or callback dependencies. Full Windows CTest gate. add_executable(ARMixFirstRunEndpointPolicyTests diff --git a/docs/ARD_8D_SONKU_BINAURAL_ENGINE_20261112.md b/docs/ARD_8D_SONKU_BINAURAL_ENGINE_20261112.md new file mode 100644 index 000000000..442d0bd11 --- /dev/null +++ b/docs/ARD_8D_SONKU_BINAURAL_ENGINE_20261112.md @@ -0,0 +1,139 @@ +# 8D-SonKu — Architecture Requirements & Decisions (ARD) +Version: 0.1 / proposed engineering architecture / 2026-11-12 +Status: architecture design only, NOT implemented or physically audio-tested. +Repository audited: `masarray/arsonmix@1d84474661e1798b4a2f03bd8e6c9fbd7e1fb1fc`. +Guidance: root `AGENTS.md`, `docs/architecture/README.md`, `docs/architecture/FEATURE_EXTENSION_PLAYBOOK.md`. + +## A. Architecture invariants / avoid naive implementation +1. Reuse ONE existing JUCE AudioIODeviceCallback and authoritative ChannelId/EdgeId PCM graph. This FX is an `AudioProcessor`/lease, not a new device/monitor/mixer/transport/JS audio engine. +2. Build high-quality *true binaural rendering*, not a panning simulator. Spatial localization = direction-dependent L/R HRTF/HRIR (ITD, ILD, pinna/torso spectral cues); acoustics = source-dependent early reflections + diffuse late reverb; effective externalization must be listening-tested. +3. Separation of concerns: independent pure motion math; dataset/backend; HRTF renderer; distance/direct-room; JUCE adapter; native editor; host session/preset adapter. No new global FX framework or per-plugin `Main.cpp` switch. +4. CONTROL thread does lookup, file IO, HRTF resample/precompute, immutable trajectory compilation, graph creation and release, validation/serialization; RT callback consumes only ready bounded storage and atomic mailbox/snapshot. +5. Preserve session/FX lease ID/graph revision/device epoch, existing rack bypass and accepted ACK/readback. Never show success from browser intent alone. Preserve old graph on failed prepare. +6. Prototype third-party HRTF facilities with a **replaceable backend seam**, benchmark before choosing a shipping dependency. Do not ship a known-unlicensed HRTF dataset/BRIR. + +## B. Existing verified seams (live source) +| Existing owner | Correct 8D-SonKu integration | +| --- | --- | +| `src/NativeBuiltInFx.h` | One catalog entry `armix.builtin.8d-sonku.v1` with generic `prepareNativeBuiltInFx`, verified sample-rate/frame constraints. **Do not** edit Harmonice identity. | +| `engine/builtin_fx/BuiltInFxCatalog.h` | Optional canonical identity constant only; do not fork a second runtime registration registry. | +| `engine/builtin_fx/ChannelCompressorProcessor.h` etc. | Pattern for prepared `juce::AudioProcessor`, state validation, realtime control envelopes and metering. Not permission to copy DSP code or duplicate a transport. | +| `engine/core/LiveChannelFxGraph.h` / `DynamicChannelFxLeaseBank.h` | Reuse stable instances, move/reorder, prepared processing, bypass/PDC and retirement. | +| `engine/core/OrbitMotion.h`, `OrbitPhase.h`, `OrbitControlPolicy.h` | Existing pure vendor-VST parameter-orbit utilities: reuse conceptual phase/shape/test mathematics if suitable; **do not** treat VST-normalized positions as physical HRTF coordinates, or route through dearVR vendor parameter UI. | +| `src/NativeMixerSessionFxRestore.h`, `src/NativeMixerSessionStore.h` | Reuse generic native FX serialization and .smix roundtrip, schema/version validation. | +| `web/approved-native-bridge.js`, `web/approved-native-contract.js`, `site/preview-*/` assembled /preview/ | Native editor commands, accepted events and UI embedded in the one approved renderer. No second alternate GUI. | +| `tests/**`, `CMakeLists.txt` | Add targeted DSP/contract/native-host tests, not a duplicate full CI pipeline. | + +## C. Proposed modular source ownership — descriptive paths, NOT files already written +``` +engine/builtin_fx/sonku/ + SonKuTypes.h // bounded state v1, source IDs, typed params, no UI + SonKuMotion.h // sample-clock phase, circle/ellipse geometry, easing + SonKuPathCompiler.h // CONTROL-only compile of path to fixed arc-length LUT + SonKuHrtfBank.h // immutable prepared HRIRs, orientation/metadata, lifetime + SonKuSpatialRenderer.h // bounded 1 or 2 emitter binaural direct sound + SonKuDistance.h // attenuation, coloration, direct/reflection ratio + SonKuRoom.h // prepared early reflections + stereo FDN late reverb + SonKuCore.h // processor-owned state + subblock render orchestration +engine/builtin_fx/SonKuSpatialProcessor.h // JUCE native built-in FX adapter +tests/sonku_*_test.cpp // pure math, audio impulse, host/session +site/.../assets/mixer-native-sonku.js // integrated assembled GUI editor ONLY +docs/PRD_8D_SONKU_SPATIAL_AUDIO_20261112.md +docs/ARD_8D_SONKU_BINAURAL_ENGINE_20261112.md +``` +Keep source count proportional to actual responsibilities: start with `SonKuMotion`, `SonKuSpatialRenderer`, `SonKuCore`, `SonKuSpatialProcessor`; split a file only when it has independently tested ownership. Avoid heavy template frameworks, abstract factories or duplicate plugin-host layers. + +## D. Signal flow / ownership +``` +Existing FX insert / accepted ChannelId graph + Stereo or Mono PCM + -> input policy (mono=one emitter; stereo=L/R virtual emitters) + -> sample-clock motion + source physical positions (no UI timer) + -> prepared HRTF direction-dependent L/R direct filters + -> distance gain/spectral shaping -> direct binaural ear sum + -> optional source-dependent early reflections (bounded delay taps) + -> optional shared stereo FDN / diffuse late tail + -> spatial wet / dry equal-loudness blend + output trim + -> normal channel FX rack/fader/WIRE/BUS/MAIN hardware outputs +``` +`SonKuCore` is exactly one internal processor graph under existing host. No new ASIO/WASAPI owner. Early reflections must be based on room source/listener geometry, not a stereo-delay trick erroneously branded as realistic 3D. + +## E. Coordinate and motion contract (unit correctness) +- Listener at origin, head fixed forward = +Y on top-down display; X positive right; Z positive up. Azimuth 0° FRONT, +90° RIGHT, ±180° REAR, -90° LEFT; positive azimuth = clockwise on the top-down graphic. +- For azimuth theta and radius r: `x=r*sin(theta)`, `y=r*cos(theta)`; `z=r*sin(elevation)` as appropriate when elevation is added. Treat physically meaningful meters separately from UI normalized radius. Avoid confusing legacy `OrbitMotionPoint.distance` normalized 0..1 VST parameter with meters. +- Two virtual objects for stereo: input L mapped to object L, input R mapped to object R with **linked** phase and user-defined angular spread by default; independent motion is optional later. One mono input maps to one emitter by default; never create two independent "speakers" from mono without explicit user enable. +- Sample-clock rotation: phase increments from the **number of rendered samples** and an explicit samples-per-revolution or tempo-linked beat count. Persist rotation state when stopping/starting according to documented pause/resume policy; modulo wrap is seamless. +- GUI head/source position is a low-rate non-authoritative snapshot. GUI render 30–60 FPS only for display; no JS setInterval audio steering. Drag requests are bounded and reconciled to native accepted state. +- Circle/ellipse mathematical evaluation is O(1); editable cubic path is compiled off-RT into bounded arc-length LUT (e.g. 1024 sample points; capacity/precision benchmarked) for approximately uniform audible velocity. Sample-clock phase indexing/interpolation O(1) in callback. +- Speed/radius/position/width changes are smoothed. Orbit shape switching uses clickless parameter morph or short position/filter crossfade, not an instantaneous HRTF impulse jump. + +## F. HRTF renderer design and algorithm decision +- Input: 1/2 mono source streams. Each prepared emitter produces **both left and right ear outputs** via direction-dependent HRIR and ITD; sum into stereo with calibrated gain and adequate headroom. Plain equal-power panning is permitted only as an explicitly labelled non-binaural diagnostic baseline. +- Use `SOFA SimpleFreeFieldHRIR` as interoperable dataset input. Validation, dataset version/attribution/redistribution permission and resampling happen before publication; missing/corrupt/unsupported SOFA fails closed to a known safe preset or rejects the new prepared instance, never parsing in callback. +- Backend decision **OPEN pending benchmark**: (A) Valve Steam Audio CPU binaural API with vetted thread/allocation/latency behavior and Apache-2.0 distribution, or (B) small deterministic native FIR/partitioned renderer driven by licensed SOFA HRIR and libmysofa (BSD-3-Clause) control-side loader. Do not commit to either from marketing alone. Benchmark direction interpolation, per-block cost, allocations and timbral artifacts before adopting. +- Sample-cost sanity: 2 sources x 2 ears x 128 FIR taps x 48,000 samples/sec = 24.576 million MAC/sec before interpolation/room/overheads. This arithmetic is an approximate *cost model*, not measured project performance. +- HRTF orientation interpolation: choose smoothly interpolated HRIR/ITD, not abrupt nearest-direction jumps. Evaluate minimum-phase and explicit ITD separation vs direct HRIR interpolation to reduce artifacts. Filter update at bounded audio subblock rate (candidate 16–64 samples), with time-domain crossfade/smoothing where needed, not reloading HRIR each audio sample. +- No HRTF dataset guarantees all users can localize front/back. Provide HRTF selection and listening calibration as a product path, rather than exaggerated fixed spectral EQ. Avoid the claim that a static generic HRTF alone will always externalize. + +## G. Acoustic space / room model +- Stage M1 has no room dependencies; truthful static HRTF must work first. M3 adds first-order shoebox/image-source reflections for limited virtual wall surfaces, using prepared delay lengths/gains/lowpass and direction-dependent early spatial cues. Parameter updates are staged and smoothed. +- One efficient **stereo shared FDN** reverb per FX instance; preallocated lines and diffusion/damping, no per-object long convolution tail by default. Keep time-varying early reflection contribution and late diffuse field separate. +- Head-relative source distance affects direct level, spectral/air cues where justified, and direct-to-reverberant ratio. Avoid pure exponential rolloff that only makes source quieter but never more external. +- `Room Mix=0` eliminates room components while preserving HRTF direct sound. Clear/retain reverb tail bypass behavior explicitly: preserve tail when power off only if host has a supported continuous-bypass contract; otherwise short fade to dry with no unbounded rendering. +- A premium measured long BRIR convolution mode is P2/offline until CPU, latency/PDC, license and user outcome justify it. No realtime ray tracing in initial shipping engine. + +## H. Realtime and lifecycle rules +- CONTROL owns `prepareToPlay`, process format validation, preallocated working buffers, HRTF dataset load/resample, path LUT compilation, preset state parse/migration, deferred destruction and editor lifetime. RT processing is fixed-size, exception-avoiding and free of memory allocations, filesystem, locks, logging, network, JS and dynamic HRTF object creation. +- Rely on existing `RealtimeNativeFxControl` / bounded queues and generic FX lease/revision fences. No new global queue infrastructure unless existing API cannot satisfy bounded state. Parameter burst must coalesce/reject safely and never corrupt accepted control state. +- Publish changed heavy objects as immutable prepared structures at safe graph/FX control boundary; old object lifetime must outlive callback readers. No destroying old HRTF/FDN in callback. Fast continuous parameters should use the existing per-processor realtime control route, not rebuild FX graph on every knob tick. +- Set finite parameter ranges; clamp only well-defined input controls; invalid NaN/Inf, malformed number, impossible size/rate, stale slot/epoch, incompatible mono/stereo and absent HRTF produce explicit negative ACK or deterministic fallback. Never silently reinterpret a rejected request as completed. +- FX process: handle arbitrary block segmentation up to host prepared maximum, silence, 0 frames if called, mono input or stereo channel, denormal flush, tail reset, rapid wet/dry, pause/restart, sample-rate reprepare. Processor publishes true `getLatencySamples`; if host PDC insufficient, disallow selected heavy quality mode until safe. +- Proper host rack bypass returns dry under existing contract. In a spatial mix, doubling dry+binaural may cause comb filtering; use a perceptually appropriate crossfade and test both mono fold and peaks. +- On device loss, logical state survives, no "Monitor Off" gate introduced by the effect. Reprepare once for new epoch. Never bind to physical pins or create a separate device callback. + +## I. Stable model and serialization +```text +SonKuStateV1: + catalogId="armix.builtin.8d-sonku.v1"; schemaVersion=1 + enabled; spatialMix; outputTrimDb + inputMode {autoMono,linkedStereo,independentStereo} + positionA/B {azimuthDeg,elevationDeg,distanceMeters} + motion {staticOrOrbit,shape,phase,periodSeconds,direction,startAngle,spreadDeg} + shape {circleRadius,ellipseAxes,advancedControlPoints[bounded]} + hrtf {profileId,qualityMode} + room {presetId,earlyLevel,lateLevel,decaySeconds,roomMix} +``` +Exact accepted native state serialization uses bounded versioned binary/typed codec, with finite/range validation and deterministic default migration. Persist pose/path and source identities, **not** executable code, HRTF sample arrays, detector history, live device identity or transient GUI pointer state. `.smix` retains effect state using generic existing FX restore; separate `.armixfx` user presets use the shared future preset library, not localStorage or plugin-owned session files. Stable FX instance identity follows move/reorder; no new ChannelId. +Acceptance = validated control ACK + accepted DSP readback for installed graph; logical-only status does not claim PCM. No GUI-only simulated audio engine. + +## J. Testing matrix (targeted and low-waste) +| Test layer | Minimum contract | +| --- | --- | +| Pure motion tests | 0/90/180/-90 direction, CW/CCW, wrap continuity, phase partition independence, varied block sizes, ellipse and arbitrary path arc-length consistency. | +| HRTF dataset tests | SOFA orientation, sample rate resample, stereo ear ordering, 0 vs 180 HRIR not swapped, front/rear directional spectral distinction, invalid/out-of-license dataset path. | +| DSP PCM tests | Static impulse per cardinal direction, ITD/ILD bounded, no NaN/denormal/clip on test fixtures, dry bypass, wet gain, silent input and arbitrary chunk sizes. | +| Motion audio tests | Direction reversal, stop/resume, tempo change, shape edit, rapid phase 0/1 crossing, front-rear interpolation without clicks. | +| Room tests | Early reflection delays/gains respond to source position; room dry, tail behavior, FDN stability/decay, no runaway feedback; source near/far clarity. | +| Host integration | Real native insert on CH05 and BUS, rack bypass, other FX order, source-only/WIRE, .smix restore, FX move identity, device epoch/rebind, negative ACK state unchanged. | +| UX | Approved /preview/ editor screenshot at tested sizes; drag/click/keyboard hit zones; accepted readback and failure; no Chrome context menu or separate preview. | +| Performance | Bench p50/p95/p99 on documented hardware at 44.1/48/96k, 64–512 frames, 1/2/4 FX instances, allocation observer, actual ASIO XRUN/crackle FAT. | +| Perceptual | Volume-matched blind 4-direction localization, confusion matrix, externalization/distance/timbre rating on diverse headphones/listeners, generic vs selected HRTF. | + +A synthetic PCM green test is not a real listening PASS. Keep docs-only PR without expensive CI; M1 native code gets fast tests then one exact-SHA native or FAT lane where justified. + +## K. Design decision log / unresolved evidence +| Decision | State | Exit evidence | +| --- | --- | --- | +| Single existing native JUCE FX ownership | FIXED | Existing source and architecture governance. | +| Physical azimuth and 2-emitter semantic model | PROPOSED | DSP phase/IR tests and usability review. | +| Steam Audio CPU backend vs SOFA-native FIR | OPEN | Comparable CPU, fidelity, latency, license, callback safety benchmarks on reference rig. | +| HRTF dataset packaging | BLOCKED on license | Individual dataset license, redistribution, attribution and version pin. Source-code license does not license dataset. | +| Room FDN and early reflection algorithm | PROPOSED | Offline impulse/perceptual A/B and CPU profile. | +| Editor graphical path precision and gesture contract | P1/P2 staged | Real browser/native integration, pointer screenshots and accepted event tests. | +| Performance threshold / sample-rate range | PROVISIONAL | Exact-SHA compiled native CPU and physical hardware evidence. | +| Absolute claim of 3D externalization quality | NOT PROVEN | Multiple-listener headphone tests meeting PRD gates. | + +## L. First implementation PR plan (after R0 documents) +One coherent M1 PR should add: minimal pure `SonKuMotion`, real prepared directional HRTF renderer, native `SonKuSpatialProcessor`, single `NativeBuiltInFx.h` registry entry, focused DSP PCM/host bypass/restore tests; touch approved GUI only when first audible insert is actually wired. Do not add CMake build cost, duplicate backends, empty scaffolding classes, fake front/back loudness or a second callback. Any feature not audible/testable stays out of M1. + +See [PRD](PRD_8D_SONKU_SPATIAL_AUDIO_20261112.md), [research](RESEARCH_8D_SONKU_SPATIAL_AUDIO_20261112.md). diff --git a/docs/PRD_8D_SONKU_SPATIAL_AUDIO_20261112.md b/docs/PRD_8D_SONKU_SPATIAL_AUDIO_20261112.md new file mode 100644 index 000000000..b2a38be39 --- /dev/null +++ b/docs/PRD_8D_SONKU_SPATIAL_AUDIO_20261112.md @@ -0,0 +1,93 @@ +# 8D-SonKu — Product Requirements Document (PRD) +Version: 0.1 / research and implementation-ready requirements / 2026-11-12 +Product: ArSonMix internal built-in FX. Status: PROPOSED; NOT implemented, acoustically verified, or field-qualified. +Owner intent: convincing **front, rear, left, right, distance, externalization and moving 360-degree binaural sonic space**, not a stereo auto-pan illusion. +Naming boundary: **Harmonice remains the independent Vocal Harmony effect**. 8D-SonKu is its own brand, catalog ID, DSP, state and editor. + +## 1. Product outcome and truth +An operator inserts 8D-SonKu on an ordinary mono or stereo mixer channel, selects a spatial movement preset, hears convincing binaural sound external to the head over headphones, sees a top-down listener/head and two moving source icons when stereo is selected, changes the orbit path by dragging it, controls speed and direction, and optionally selects a virtual acoustic room. All audible effects must run in the **ONE** native ArSonMix JUCE PCM callback/accepted FX graph; browser /preview/ is only presentation. Do not claim 3D realism merely because speaker dots move. Front/back discrimination, smooth motion, distance and listening tests are gates. + +## 2. Target users / jobs to be done +- Singer/performer: one-click spatial vocal motion without opening a routing wizard or losing live monitoring. +- Music producer / stream creator: exciting stereo or mono sound motion at a controlled pace, in a selected acoustic room. +- Sound designer: freeform positioning, path shape, movement automation and repeatable saved presets. +- Advanced mixer operator: reliable CPU load, true rack bypass, state recall, sample-accurate timeline-based motion where provided, mono-compatible fallback. + +## 3. Primary journey (P0) +1. Select existing CH or BUS -> FX Rack -> add "8D-SonKu" from verified native built-in FX picker. +2. Processor is prepared on CONTROL side, installed via existing FX lease. No device restart, special ARM/Monitor action, or second audio output. +3. Open the FX editor: head+headphones centered in large compact top-down visual; FRONT above, REAR below, LEFT and RIGHT explicitly marked. Stereo: independent L/R source glyphs, not physical speakers. Mono: one source glyph, or linked duplicated glyphs only when explicitly enabled. +4. Choose `Circle 360°` -> `Play motion`. Hear movement front -> right -> rear -> left, not just left/right loudness. +5. Drag source to change start location; drag orbit handles to adjust radius/ellipse; adjust revolution time, clockwise/counterclockwise, source spread, distance and wet amount. Editable advanced path is phase P2. +6. Choose virtual space (e.g. Dry/Open, Small Studio, Live Room, Large Hall), independently adjusting early reflections and late reverb via a simple Room Mix. Default room must enhance localization without drowning direct signal. +7. Toggle rack power/bypass, save/open .smix, reorder FX, switch input/device and reopen: same accepted state, no unsolicited route/graph reset. Audio is truthful only when physical route is installed. + +## 4. Scope and priority +| ID | Priority | Requirement / operator-visible acceptance | +| --- | --- | --- | +| PR-01 | P0 | Verified native built-in FX picker entry `8D-SonKu`, stable `armix.builtin.8d-sonku.v1` identity, independent of Harmonice. | +| PR-02 | P0 | Genuine HRTF binaural direct sound for mono input and two virtual emitters for stereo input, stereo output to headphones. No mere equal-power pan marketed as 3D. | +| PR-03 | P0 | Clear independent FRONT(0), RIGHT(+90), REAR(180), LEFT(-90) static positions; direct positioning works when orbit stopped. | +| PR-04 | P0 | Orbit phase advances from the **audio sample clock**, not browser animation frames. Adjustable period, CW/CCW, start angle and stable pause/resume. | +| PR-05 | P0 | Compact top-down GUI shows listener/head with headphones, two stereo source glyphs following audible phase, draggable start points, circle radius/ellipse handles. GUI never drives PCM timing. | +| PR-06 | P0 | Smoothed position/HRTF/distance changes: no audible zipper, clicks or sudden dry/wet discontinuities; bypass remains safe with room tail policy documented. | +| PR-07 | P0 | Dry/direct vs spatial wet and output trim, conservative gain/headroom; quality checked on actual headphones. Mono and silence behave deterministically. | +| PR-08 | P0 | Native prepare, editable parameter ACK/readback, .smix roundtrip, FX bypass, move/reorder, graph revision/device epoch protection. No new callback or second master. | +| PR-09 | P0 | Headphone playback is clearly communicated. Speaker listening is not promised to provide spatial externalization. No false "headphone detected" claim. | +| PR-10 | P1 | Preset acoustic spaces: Dry/Open, Small Studio, Live Room, Hall; moving-source-aware early reflections, shared algorithmic diffuse reverb and controllable Room Mix. Original, not copied dearVR presets/IRs. | +| PR-11 | P1 | Subjective HRTF audition/calibration: front/rear/left/right examples and a small verified/licensed HRTF profile set with user choice; no assumption one generic HRTF fits everyone. | +| PR-12 | P1 | MIDI/host tempo sync where a reliable timeline exists; otherwise manual seconds-per-revolution remains fully functional. No inferred/fake BPM or GUI timer as audio clock. | +| PR-13 | P1 | Linked stereo orbit as default; independent per-emitter motion as an advanced choice. Preserve L/R source identity, controllable spread and downmix compatibility. | +| PR-14 | P2 | User-editable freeform closed Bézier path (bounded control points), normalized arc-length traversal and undo/reset; saved in plugin state. | +| PR-15 | P2 | Elevation/vertical orbit and optional genuine listener head tracking, only after basic horizontal externalization proves successful. | +| PR-16 | P2 | Offline high-quality HRTF/room rendering and user preset integration through shared native built-in FX preset service when it is production-ready. | + +### Default settings (candidate; tuning required) +- Stereo Linked Orbit / Circle; 12 s per revolution; clockwise; headphone output; room Small Studio with restrained room mix. +- Source separation adjustable; center-front reference is azimuth 0 deg. Direct signal has priority over reflections/reverb. No hidden automatic head movement, no listener-mode auto-switch on device selection. +- `Dry` preset must actually disable room reflections/reverb while retaining directional HRTF; FX bypass must actually return unprocessed input through the host's normal bypass contract. +- All candidate defaults may change after loudness-matched listening validation, not through arbitrary visual tuning. + +## 5. UX contract (compact and premium, no bulky cards) +- Main editor: restrained header with name / power / preset, **dominant circular trajectory stage**, head illustration, two small luminous L/R source glyphs, directional marks. Distinguish source positions and listener orientation; do not display two "hardware output speakers". +- Right/bottom secondary controls: `Motion: [Static | Orbit]`, `Shape: Circle / Ellipse`, `Speed: seconds per revolution`, `Direction: CW/CCW`, `Spread`, `Distance`, `Spatial Mix`, `Room preset`, `Room Mix`. Show only relevant fields. Use shared approved UI tokens, compact typography and appropriate control affordances. +- Dragging trajectory or source shows preview locally, then sends a bounded, validated native intent; accepted state/graph drives authoritative visible controls. Pending/rejected actions must be distinguishable without false audio claims. +- No default Chrome context menu, no new topbar mode, no new public /preview-v2/ product page. Exact native assembled /preview/ remains authoritative. +- Keyboard: pointer-free selection, arrow nudge, Enter accept, Escape cancel, Reset path; touch targets tested for mouse/touch and small windows. +- Static mode is first-class: pure front/rear placement must not require motion playing. Make A/B evaluation possible. + +## 6. Nonfunctional requirements (measured, not assumed) +- Realtime: zero heap allocation, file IO, blocking lock, plugin scanning, HRTF parsing or GUI/JS communication inside PCM callback. Prepare on control side. No per-frame browser timer driving sound. +- Audio format: initial 44.1/48/96 kHz at 64/128/256/512 frames; later 32..192 kHz subject to actual DSP test. Unsupported formats reject **before** publication and preserve previously accepted graph. +- Deadline design budget at 48k/128 (2.667 ms callback period): **candidate** one instance 99th-percentile DSP <= 10% of block period on a published reference CPU, and 4 instances combined <= 30%. Update limits after genuine profiling, SIMD and device tests; percentages are engineering goals, not measured results. +- No unreported lookahead or unexpected host latency. If selected renderer incurs algorithmic latency, report and compensate via existing native PDC or reject until safe. Do not silently claim "zero latency". +- Deterministic offline replay for fixed rate/path/seed; callback partition invariance; finite outputs under silence, full-scale, denormals, corrupt/rejected state, repeated device reprepare and sample-rate changes. +- Explicit user-level latency, CPU quality and wet gain behavior; preserve independent ASIO primary / secondary stream bridge; do not alter device manager for this FX. + +## 7. Perceptual release gates +- Objective: compare rendered HRTF/BRIR IRs, ITD/ILD and spectral cues, front-vs-rear distinctness, filter transitions, delay continuity, loudness and clipping against ground-truth target/known datasets. +- Blind headphone listening: static positions front/rear/left/right; randomized order and matched volume on multiple real listeners, multiple headphone models, both generic and selected HRTF. Capture confusion matrix (especially front/rear), perceived externalization and distance (1–5), tone coloration and preference. +- Candidate target **after HRTF selection**: >=75% correct front-vs-rear discrimination across eligible test listeners and median >=4/5 for externalization; report participant count, confidence interval and individual failures. This is an aspirational gate and may need revision; never report it as achieved without listening data. +- Motion: sound follows 360-degree path in listening test; no perceived discontinuities at angle wrap, ellipse extrema, direction reversal or period changes. Mono-fold and bypass A/B must not create destructive artifacts. +- Tests don't certify physical ASIO FAT. Release needs measured callback p95/p99, Xruns/crackles, device reconnect and headphone listening evidence. + +## 8. Product boundaries / anti-requirements +No dearVR binary/source/reverb preset copying, unlicensed HRTF dataset distribution, false Dolby Atmos claim, full 3D ray-traced room by default, second JUCE AudioIODeviceCallback, new routing gate, automatic mic hardware rebind, hidden monitor switch, AI model, GPU dependency, speculative "all listeners" perfection, or replacing existing Harmonice Vocal Harmony. + +## 9. Delivery milestones +- **R0 (this document):** verified references, PRD, ARD, repository seam, risks, performance and perceptual gates. **No claim of audible implementation.** +- **M1:** real 4-direction static two-emitter HRTF PCM core + native built-in insert, prepared state/latency/bypass, synthetic impulse and callback stress tests. Hardware/device unchanged. +- **M2:** phase-clock 360° linked orbit, circle/ellipse geometry, host parameter control, deterministic offline A/B PCM and static/moving audio fixtures. +- **M3:** original early reflections + shared FDN room presets, self-consistent distance, filter smoothing, loudness matching and real headphones front/back qualification. +- **M4:** native approved /preview/ editor + drag path UX, accepted ACK/readback, session restore, responsive screenshot/gesture qualification. +- **M5:** HRTF selection/calibration, independent stereo paths and advanced paths if proven useful, benchmark/tune CPU, integrated selective native/GUI CI and independent physical ASIO FAT. +- One scoped PR per meaningful *working* vertical milestone where practical. Docs-only change gets diff/references audit, no Windows CI dispatch. + +## 10. Acceptance for first audible milestone (M1) +1. Insert native 8D-SonKu on CH05 -> FRONT input is processed to an actual stereo output path with measurable HRTF left/right filters, normal channel route and monitoring untouched. +2. 0/90/180/270 azimuth outputs are distinguishable in generated PCM/IR and finite; input silence remains silence, mono and stereo semantics are explicit. +3. Rack OFF produces tested dry behavior with bounded transition; restart and .smix restore retain settings or fail closed with no corrupted graph. +4. Deterministic callback tests at varied frames; no heap allocation/blocking in processBlock. +5. **No "3D verified" badge until blind headphone front/rear listening succeeds.** + +See: [ARD](ARD_8D_SONKU_BINAURAL_ENGINE_20261112.md), [research evidence](RESEARCH_8D_SONKU_SPATIAL_AUDIO_20261112.md), and existing [feature playbook](architecture/FEATURE_EXTENSION_PLAYBOOK.md). diff --git a/docs/RESEARCH_8D_SONKU_SPATIAL_AUDIO_20261112.md b/docs/RESEARCH_8D_SONKU_SPATIAL_AUDIO_20261112.md new file mode 100644 index 000000000..13dd8d657 --- /dev/null +++ b/docs/RESEARCH_8D_SONKU_SPATIAL_AUDIO_20261112.md @@ -0,0 +1,55 @@ +# 8D-SonKu — Technical & Perceptual Research Evidence +Date: 2026-11-12. Status: desktop research, not first-hand FFT/CPU/ASIO/listener evidence. Scope: lawful independent internal FX, not copying dearVR code/IRs. + +## Sources and what they do / do not prove +1. **dearVR PRO 2 official manual (Jan 2024)**: https://files.plugin-alliance.com/products/dearvr-pro-2/dearvr-pro-2_manual.pdf + - Chapters 1–3 identify HRTF binaural directions, distance, coordinate input, early reflections with source position, late reverberation and 46 virtual acoustic presets. Product also admits front/back confusion and importance of head motion. + - **Implication**: reference UX and acoustic *requirements*, not a license or recipe to replicate proprietary algorithms, graphics or impulse responses. +2. **Steam Audio SDK C API guide and HRTF**: https://valvesoftware.github.io/steam-audio/doc/capi/guide.html ; https://valvesoftware.github.io/steam-audio/doc/capi/hrtf.html ; https://github.com/ValveSoftware/steam-audio + - HRTF is a direction-dependent pair of L/R filters. Bilinear directional interpolation is smoother than nearest (at higher cost). Expensive HRTF construction must happen outside audio thread. Reflections can be much heavier. Open source Apache-2.0 code, source distributions/NOTICE obligations to review. + - **Implication**: engineering reference and possible tested backend; NOT proof its runtime is allocation-free under ArSonMix callback or compatible with every supported small ASIO buffer. +3. **SOFA / AES69**: https://www.sofacoustics.org/ ; https://www.sofacoustics.org/mediawiki/index.php/SimpleFreeFieldHRIR + - Standard interoperability format for HRTF and spatial room IR; orientation, coordinates and receiver ordering are defined by convention. + - **Implication**: establish data contract, reject unsupported data and explicitly check dataset redistribution license before bundling. +4. **libmysofa**: https://github.com/hoene/libmysofa + - Provides C SOFA file reading/resampling/interpolation tools, code under BSD-3-Clause (with third-party/component and dataset license review). + - **Implication**: useful OFF-RT dataset reader, not a complete optimized spatial/room renderer. +5. **Auditory localization practical review (2024)**: https://www.frontiersin.org/journals/psychology/articles/10.3389/fpsyg.2024.1408073/full + - Generic/non-individualized HRTFs commonly produce front/back confusion; reverberation sometimes improves localization but findings vary. + - **Implication**: cannot market front/back realism as universal or solve it solely by adding more reverb. +6. **Frontal binaural externalization study (Aug 2026)**: https://pmc.ncbi.nlm.nih.gov/articles/PMC13451706/ + - Reports improvements in externalization via level and strategic early-reflection adjustment of non-individualized binaural room IRs. + - **Implication**: source-dependent early reflections/direct-to-reverb relationship should be evaluated with blinded listening, not only acoustic numerics. +7. **2025 room-based binaural conference study**: https://pub.dega-akustik.de/DAS-DAGA_2025/files/upload/paper/397.pdf + - Discusses plausible binaural room rendering from direct sound, limited early reflections and common late reverb. Full ray tracing is not an initial requirement. + - **Implication**: prototype a bounded hybrid acoustic room without complex real-time geometry ray tracing. + +## Evidence weighting / developer decision +- HIGH confidence: HRTF binaural left/right processing is needed for positional cues; moving HRTF should use smooth interpolation; sample-domain motion must be audio-clock-based; real acoustic reflections matter to externalization; native callback ownership follows one existing JUCE graph. +- MEDIUM confidence: two short-HRIR emitter paths + bounded early reflections + one FDN can achieve desirable CPU efficiency; requires prototype benchmarks and psychoacoustic evaluation. +- NOT ESTABLISHED: 8D-SonKu front-back headphone discrimination quality, CPU and latency on user's rig, shipped dataset license, relative quality vs dearVR, HRTF profile that fits all listeners. + +## Early technical trade-offs to measure +| Candidate | Why consider | Risk / experiment | +| --- | --- | --- | +| Steam Audio CPU HRTF backend | Mature direction-dependent engine, documented interpolation, supported SOFA | Native dependency packaging, callback behavior at 64/128 frames, cost with 2 emitters; benchmark and license inventory. | +| Native FIR/FFT backend + libmysofa control loader | Precise fixed-size RT contract, full ownership, little per-plugin binary weight | Needs rigorously tested orientation/delay/interpolation, spectral coloration and front/back listening. | +| Full room ray tracing | Rich physical scene potential | Not justified for static compact room presets; CPU, geometry tooling and render cost excessive for initial internal FX. | +| First-order reflections + FDN | Bounded CPU and sufficient initial room plausibility candidate | Need physically credible delay/direction/gain and real externalization verification. | + +## Required benchmark / audio lab protocol +- Fix auditable sample files: impulses/noise/voice/music stem, mono and stereo, seeded deterministic motion; record reference input/processing gain, profile and filter lengths. +- Run same 4-direction and rotating trajectory through both candidate HRTF renderers; compare transfer IRs, ITD, spectral errors, CPU p99, quality at buffer 64/128/256, at 44.1/48/96 kHz. Verify callbacks don't allocate. +- Choose one initially verified, **individually redistributable** HRTF dataset; document version, listener/ear orientation, source elevation coverage, SHA256, license/attribution. +- Blind headphone listening test includes multiple HRTF profiles and several headphone/listener combinations, not just developer's own ears. Record front/rear confusion, externalization, distance, timbral coloration, clicks and preference; compare with normal stereo pan as baseline. +- Avoid misleading use of the term "8D": technical output remains **2-channel binaural** with a dynamic 3D sound field, not 8 physical audio channels. + +## Repo-specific verified orientation +- `src/NativeBuiltInFx.h` registers built-in processors independently: Parametric EQ, Compressor, Harmonice, Vocal Throw. +- `engine/core/OrbitMotion.h` is vendor-VST normalized orbit geometry, **not** the native HRIR spatializer and **not** physical-meter mapping. +- `engine/core/LiveChannelFxGraph.h` reuses processor instances across mixer graph revisions and does not require duplicating a JUCE callback. +- `docs/architecture/FEATURE_EXTENSION_PLAYBOOK.md` describes narrow built-in FX path, typed control, verified native insert, session state, bounded CI. +- No `8D-SonKu` implementation was found in default-branch repository code search at the above audit checkpoint; this is not a guarantee that future PRs won't add it. + +## Design recommendation +R0: publish PRD and ARD (this branch). M1: implement true 4-direction native HRTF core with one stable insert identity, PCM tests and safe bypass. M2: add sample-driven orbit. M3: real room. M4: premium path editor, calibration. Gate perfection claims on measured listening evidence. diff --git a/docs/THIRD_PARTY_8D_SONKU_HRTF.md b/docs/THIRD_PARTY_8D_SONKU_HRTF.md new file mode 100644 index 000000000..2fe6caa3c --- /dev/null +++ b/docs/THIRD_PARTY_8D_SONKU_HRTF.md @@ -0,0 +1,31 @@ +# 8D-SonKu measured HRIR redistribution and attribution +Date 2026-11-12. Source: 8D-SonKu `SonKuMeasuredHrir.h`. +- Original HRIR measurements: Bill Gardner and Keith Martin, MIT Media Laboratory, 1994. MIT KEMAR (0° elevation). +- MIT Media Laboratory terms are reported in the OpenAL Soft MIT_KEMAR.def: free of charge without usage restrictions provided original authors are cited. https://github.com/kcat/openal-soft/blob/master/utils/MIT_KEMAR.def +- C table format and 44.1/48 kHz processed 128/140-tap values derived from **Aristotel Digenis, MIT HRTF C Library**, https://github.com/jhonmark/mit-hrtf-lib (MIT license; copyright 2007 Aristotel Digenis; repository LICENSE copyright 2014 greekgoddj). +- Source path: `source/normal/mit_hrtf_normal_44100.h` and `source/normal/mit_hrtf_normal_48000.h`; only the 0° elevation 0–180° at 5° spacing; 44.1 kHz rows zero-padded to 140; negative 180..360 by ear symmetry. +- **These are general-purpose nonindividualized HRIRs**. Front/rear externalization is NOT guaranteed. No dearVR code or IR is used. + +MIT License (MIT) +Copyright (c) 2014 greekgoddj +Copyright (c) 2007 Aristotel Digenis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Packaging gate: ensure this attribution/license is included in release distribution notices; source-only doc is not enough to certify an installer. Dataset provenance should be independently legal-reviewed before any commercial redistribution claim. diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h new file mode 100644 index 000000000..d0f9ed31b --- /dev/null +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "sonku/SonKuSpatialCore.h" +#include "FxSpsc.h" +#include "../core/RealtimeNativeFxControl.h" +#include +#include +#include + +// Built-in insert only; JUCE VST3 packaging is a separate adapter/quality gate. +// Existing FX instance owns bypass, MIDI scratch, ChannelId, PDC and retirement. +namespace armix::builtin_fx { +class SonKuSpatialProcessor final : public juce::AudioProcessor, + public armix::mixer::RealtimeNativeFxControl { +public: + static constexpr const char* catalogIdentity="armix.builtin.8d-sonku.v1"; + struct Completion {std::uint64_t requestId=0;armix::sonku::Settings settings{};bool applied=false;}; + SonKuSpatialProcessor() + : juce::AudioProcessor(BusesProperties() + .withInput("Input",juce::AudioChannelSet::stereo(),true) + .withOutput("Output",juce::AudioChannelSet::stereo(),true)) {} + const juce::String getName() const override {return "8D-SonKu";} + bool acceptsMidi() const override {return false;} + bool producesMidi() const override {return false;} + bool isMidiEffect() const override {return false;} + double getTailLengthSeconds() const override {return 0.;} + int getNumPrograms() override {return 1;} + int getCurrentProgram() override {return 0;} + void setCurrentProgram(int) override {} + const juce::String getProgramName(int) override {return "Current";} + void changeProgramName(int,const juce::String&) override {} + bool hasEditor() const override {return false;} + juce::AudioProcessorEditor* createEditor() override {return nullptr;} + bool isBusesLayoutSupported(const BusesLayout& layout) const override { + return layout.getMainInputChannelSet()==juce::AudioChannelSet::stereo() + && layout.getMainOutputChannelSet()==juce::AudioChannelSet::stereo(); + } + void prepareToPlay(double rate,int) override { + ready_=core_.prepare(rate); + observedAzimuthDegrees_.store(accepted_.startAzimuthDegrees,std::memory_order_relaxed); + if(ready_)ready_=core_.setSettings(accepted_); + } + void releaseResources() override {ready_=false;} + void processBlock(juce::AudioBuffer& pcm,juce::MidiBuffer&) override { + juce::ScopedNoDenormals noDenormals; + if(!ready_||pcm.getNumChannels()<2||pcm.getNumSamples()<=0)return; + consumeRealtimeEdits(); + core_.process(pcm.getWritePointer(0),pcm.getWritePointer(1),pcm.getNumSamples()); + observedAzimuthDegrees_.store(static_cast(core_.azimuthDegrees()), + std::memory_order_relaxed); + } + void processBlock(juce::AudioBuffer&,juce::MidiBuffer&) override {} + void consumeRealtimeEdits() noexcept override { + Edit next; + if(!ready_||!complete_.canPush()||!queue_.pop(next))return; + const bool ok=core_.setSettings(next.settings); + complete_.push({next.requestId,next.settings,ok}); + } + // Control thread: returns QUEUED, not accepted/applied. Host native ACK + // is permitted only after corresponding completion/readback. + bool queueSettings(const armix::sonku::Settings& next,std::uint64_t requestId) noexcept { + return ready_&&requestId&&armix::sonku::valid(next) + &&queue_.push(Edit{requestId,next}); + } + bool pollCompletion(Completion& done) noexcept { + if(!complete_.pop(done))return false; + if(done.applied)accepted_=done.settings; + return true; + } + armix::sonku::Settings acceptedSettings() const noexcept {return accepted_;} + bool isReady() const noexcept {return ready_;} + float observedAzimuthDegrees() const noexcept { + return observedAzimuthDegrees_.load(std::memory_order_relaxed); + } + void sealForRealtime() noexcept override {published_=true;} + bool stateSnapshotQuiescent() const noexcept override { + return queue_.empty()&&complete_.empty(); + } + // CONTROL only; state is accepted, not speculative or PCM-owned. + void getStateInformation(juce::MemoryBlock& dest) override { + juce::MemoryOutputStream out(dest,false); + out.writeInt(0x534F4E4B); // SONK + out.writeInt(1); + out.writeFloat(accepted_.startAzimuthDegrees); + out.writeFloat(accepted_.revolutionSeconds); + out.writeFloat(accepted_.stereoSpreadDegrees); + out.writeFloat(accepted_.spatialMix); + out.writeFloat(accepted_.outputTrim); + out.writeByte(accepted_.moving?1:0); + out.writeByte(accepted_.clockwise?1:0); + } + bool restoreUnpublishedState(const void* data,int size) { + if(published_||!data||size!=30||!queue_.empty()||!complete_.empty())return false; + juce::MemoryInputStream in(data,static_cast(size),false); + if(in.readInt()!=0x534F4E4B||in.readInt()!=1)return false; + armix::sonku::Settings next{}; + next.startAzimuthDegrees=in.readFloat(); + next.revolutionSeconds=in.readFloat(); + next.stereoSpreadDegrees=in.readFloat(); + next.spatialMix=in.readFloat(); + next.outputTrim=in.readFloat(); + const int moving=in.readByte(),clockwise=in.readByte(); + if(moving>1||clockwise>1||!in.isExhausted())return false; + next.moving=moving!=0; + next.clockwise=clockwise!=0; + if(!armix::sonku::valid(next))return false; + if(ready_&&!core_.setSettings(next))return false; + accepted_=next; + return true; + } + void setStateInformation(const void* data,int size) override { + (void)restoreUnpublishedState(data,size); + } +private: + struct Edit {std::uint64_t requestId=0;armix::sonku::Settings settings{};}; + armix::sonku::SonKuSpatialCore core_{}; + FxSpsc queue_{}; + FxSpsc complete_{}; + armix::sonku::Settings accepted_{}; + std::atomic observedAzimuthDegrees_{0.f}; + bool ready_=false; + bool published_=false; +}; +} // namespace armix::builtin_fx diff --git a/engine/builtin_fx/sonku/SonKuMeasuredHrir.h b/engine/builtin_fx/sonku/SonKuMeasuredHrir.h new file mode 100644 index 000000000..0116db498 --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuMeasuredHrir.h @@ -0,0 +1,317 @@ +// SPDX-License-Identifier: MIT +// 8D-SonKu horizontal HRIR bank from the MIT KEMAR measured dataset. +// Original measurements: Bill Gardner and Keith Martin, MIT Media Laboratory (1994). +// Source tables: Aristotel Digenis, MIT HRTF C Library (MIT), 2007, +// https://github.com/jhonmark/mit-hrtf-lib, source/normal/mit_hrtf_normal_{44100,48000}.h. +// Extracted ORIGINAL 0-elevation measurements every 5 degrees from 0 to 180. +// For negative azimuth the opposite-ear symmetric measurement is used. +// Taps: 128 at 44.1k, 140 at 48k. 44.1k rows are zero padded to 140. +// See docs/THIRD_PARTY_8D_SONKU_HRTF.md for attribution and dataset limitations. +#pragma once +#include + +namespace armix::sonku::hrir { +inline constexpr int directions = 37; +inline constexpr int taps = 140; +inline constexpr int spacingDegrees = 5; +inline constexpr std::int16_t normal44100[directions][2][taps] = { + { // 0 degrees, measured left/right ears + {5,-6,19,-24,39,-56,74,-101,120,-137,161,30,5321,6066,-6762,-253,195,-5129,7285,5986,2332,11785,11069,-6536,-5109,4539,-8167,-13539,-2026,-1365,-7336,-1277,3012,80,1084,4212,3286,1359,2467,1543,-905,-191,1215,-587,-1697,-1097,-1235,-2135,-2711,-2422,-2046,-1331,-253,114,194,681,1310,1375,929,696,553,151,-244,-225,-474,-819,-699,-736,-921,-736,-542,-605,-447,-73,76,157,352,549,419,112,-34,-6,-104,-306,-273,-311,-395,-292,-165,-175,-147,-5,-60,-246,-136,59,57,16,36,-37,-145,-119,-153,-195,-179,-216,-240,-128,25,74,12,-44,-33,-95,-202,-185,-158,-192,-162,-83,-51,-27,-21,-53,-58,-38,-56,-58,0,0,0,0,0,0,0,0,0,0,0,0}, + {5,-6,19,-24,39,-56,74,-101,120,-137,161,30,5321,6066,-6762,-253,195,-5129,7285,5986,2332,11785,11069,-6536,-5109,4539,-8167,-13539,-2026,-1365,-7336,-1277,3012,80,1084,4212,3286,1359,2467,1543,-905,-191,1215,-587,-1697,-1097,-1235,-2135,-2711,-2422,-2046,-1331,-253,114,194,681,1310,1375,929,696,553,151,-244,-225,-474,-819,-699,-736,-921,-736,-542,-605,-447,-73,76,157,352,549,419,112,-34,-6,-104,-306,-273,-311,-395,-292,-165,-175,-147,-5,-60,-246,-136,59,57,16,36,-37,-145,-119,-153,-195,-179,-216,-240,-128,25,74,12,-44,-33,-95,-202,-185,-158,-192,-162,-83,-51,-27,-21,-53,-58,-38,-56,-58,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 5 degrees, measured left/right ears + {-1,4,0,9,-17,31,-48,59,-82,100,-120,144,124,5029,4987,-5784,203,-165,-4327,6301,5304,2584,10535,9884,-5043,-4165,3342,-7205,-11684,-2271,-1535,-6311,-1339,2340,228,891,3388,2860,1253,2102,1665,-451,-167,1228,-110,-1537,-1189,-1189,-2285,-2652,-1955,-1617,-1236,-238,345,377,410,786,1062,741,424,342,104,-203,-242,-469,-759,-662,-638,-838,-690,-432,-431,-324,-5,167,209,308,381,277,40,-124,-103,-183,-294,-200,-214,-305,-227,-113,-176,-159,-40,-96,-219,-115,42,5,-34,-14,-88,-152,-120,-120,-145,-152,-185,-186,-89,10,71,37,-20,-42,-113,-200,-190,-172,-205,-174,-107,-84,-75,-50,-51,-54,-43,-28,0,0,0,0,0,0,0,0,0,0,0,0}, + {-9,28,-33,50,-68,76,-95,97,-103,117,-77,4475,8319,-6512,-2471,1694,-6346,6855,7572,1717,11669,13632,-6063,-7855,5529,-6589,-15651,-3317,-262,-7887,-2624,3606,261,481,4499,4182,1486,2647,2101,-1007,-712,1128,-439,-1753,-1114,-1140,-2033,-2692,-2747,-2572,-1744,-611,-248,160,1123,1601,1606,1176,901,742,343,-144,-241,-429,-821,-735,-738,-992,-842,-634,-688,-586,-196,-12,69,324,552,531,254,70,54,-35,-278,-231,-246,-479,-430,-218,-218,-206,-34,-40,-244,-148,121,103,41,66,15,-109,-86,-144,-236,-210,-254,-291,-200,-32,58,17,-43,-49,-69,-175,-166,-132,-194,-160,-91,-46,-16,20,-13,-56,-35,-56,-79,-54,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 10 degrees, measured left/right ears + {-5,4,0,-1,10,-14,23,-33,45,-65,82,-100,125,241,4833,3891,-4977,550,-574,-3424,5604,4722,2826,9638,8663,-4177,-3422,2433,-6438,-10180,-2218,-1611,-5553,-1207,1918,217,617,2911,2499,1048,2059,1742,-261,-86,1061,-58,-1214,-1103,-1375,-2287,-2278,-1604,-1466,-1062,-162,408,517,387,406,559,471,301,182,-88,-225,-191,-488,-759,-604,-591,-726,-526,-253,-235,-159,77,172,196,198,229,136,-41,-158,-179,-237,-297,-145,-137,-245,-218,-120,-122,-147,-73,-114,-201,-101,28,7,-60,-50,-96,-156,-127,-130,-151,-139,-142,-157,-94,22,86,39,-37,-67,-115,-173,-166,-191,-228,-191,-132,-101,-82,-56,-68,-55,-25,0,0,0,0,0,0,0,0,0,0,0,0}, + {30,-35,47,-51,57,-64,42,-13,1,-19,3352,10248,-5107,-5417,2920,-7065,5977,9294,1284,11548,15887,-4951,-10580,5574,-4914,-16853,-4781,271,-7837,-3814,3714,529,50,4282,4959,1899,2762,2696,-790,-1627,784,416,-1762,-1378,-1042,-2020,-2777,-2909,-2987,-2390,-1198,-282,467,1281,1726,1921,1515,1067,798,407,-40,-143,-377,-880,-782,-706,-1032,-938,-658,-783,-744,-279,-42,44,273,534,609,381,134,49,-6,-216,-202,-226,-448,-450,-310,-310,-318,-104,-43,-201,-128,147,190,115,116,43,-108,-106,-120,-219,-237,-278,-351,-274,-100,18,4,-69,-57,-59,-133,-130,-103,-173,-172,-96,-60,-17,44,10,-46,-40,-64,-86,-55,-83,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 15 degrees, measured left/right ears + {0,-4,3,0,1,4,-6,15,-28,37,-53,61,-77,103,296,4436,3255,-4257,615,-606,-2884,4961,4285,2777,8719,7845,-3382,-2995,2063,-5557,-8960,-2127,-1590,-4954,-1251,1531,-23,386,2554,2111,1101,2129,1720,-153,0,886,-123,-907,-917,-1407,-2026,-1989,-1603,-1331,-843,-99,318,381,266,247,277,195,119,14,-127,-234,-226,-409,-686,-580,-490,-516,-303,-126,-135,-98,53,122,95,106,145,68,-110,-204,-178,-246,-269,-156,-139,-211,-162,-88,-142,-139,-91,-121,-193,-86,37,5,-30,-62,-126,-179,-154,-160,-158,-109,-121,-121,-68,14,49,-1,-54,-80,-94,-140,-165,-200,-240,-187,-133,-115,-93,-65,-60,-60,0,0,0,0,0,0,0,0,0,0,0,0}, + {-9,24,-28,9,15,-68,114,-159,157,1906,11331,-1596,-9067,3308,-6516,3499,11412,1368,10570,18210,-2316,-13403,4333,-2415,-17790,-6712,950,-7503,-5274,3878,868,-535,3844,5524,2372,2762,3568,-817,-2583,927,1213,-1738,-1318,-1049,-2274,-2834,-2872,-3655,-3383,-1395,134,668,1145,1743,2270,1893,1212,846,473,-19,-144,-288,-841,-836,-740,-1065,-970,-626,-834,-861,-363,-45,19,230,544,683,426,130,84,71,-183,-211,-179,-446,-482,-350,-393,-407,-130,-11,-177,-166,167,282,207,157,61,-84,-89,-103,-251,-259,-292,-391,-343,-150,9,8,-85,-99,-46,-109,-126,-52,-130,-163,-108,-63,-26,35,25,-44,-52,-58,-83,-58,-60,-56,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 20 degrees, measured left/right ears + {0,-3,-3,5,-2,0,4,-4,13,-22,33,-44,50,-59,85,296,3966,2877,-3622,604,-554,-2447,4344,3827,2660,7781,7257,-2615,-2613,1904,-4638,-7875,-2071,-1516,-4536,-1344,1056,-250,281,2156,1991,1253,2003,1656,-4,35,759,-62,-704,-718,-1233,-1858,-1890,-1506,-1126,-738,-244,-6,141,288,231,35,-69,-32,2,-90,-227,-236,-326,-478,-439,-421,-376,-205,-116,-130,-118,11,80,69,65,71,-12,-142,-206,-165,-199,-262,-180,-138,-181,-159,-101,-139,-147,-70,-74,-153,-83,37,9,-63,-69,-135,-195,-171,-155,-133,-104,-96,-104,-74,-25,-3,-23,-61,-50,-77,-135,-151,-170,-189,-184,-135,-120,-101,-74,-75,0,0,0,0,0,0,0,0,0,0,0,0}, + {-13,30,-53,84,-158,220,-277,310,642,10739,3684,-11622,1257,-4219,330,12241,2626,9368,19370,1873,-14620,1031,170,-17051,-9850,650,-5506,-7085,3039,2132,-954,2823,5676,3408,2479,3581,-427,-2623,625,1731,-1079,-1518,-1025,-2175,-3056,-3210,-4328,-4292,-1291,845,417,857,2001,2550,2081,1235,931,628,60,-205,-324,-825,-839,-739,-1122,-1056,-629,-749,-903,-422,-18,-40,188,561,704,453,168,40,68,-70,-174,-163,-472,-587,-459,-400,-383,-156,-3,-151,-189,125,335,279,199,98,-57,-87,-107,-244,-291,-317,-445,-433,-200,8,52,-65,-107,-82,-117,-125,-61,-102,-154,-86,-61,-44,15,7,-60,-91,-74,-64,-15,-12,-47,12,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 25 degrees, measured left/right ears + {-3,1,0,-3,2,0,2,5,-3,12,-19,30,-38,42,-41,75,249,3435,2693,-2995,444,-342,-2078,3599,3487,2443,6818,6852,-1797,-2263,1812,-3643,-6898,-2102,-1489,-4128,-1546,531,-285,194,1903,1904,1229,1914,1598,124,102,789,86,-641,-749,-1046,-1587,-1702,-1338,-1186,-949,-510,-179,44,147,110,-47,-128,-43,109,-17,-199,-124,-180,-355,-359,-405,-437,-246,-94,-141,-128,28,65,1,0,37,-25,-134,-167,-144,-197,-241,-175,-161,-205,-161,-115,-135,-111,-24,-30,-115,-79,-9,-40,-77,-69,-121,-173,-165,-148,-128,-105,-115,-136,-93,-31,-15,-47,-64,-42,-61,-109,-112,-116,-153,-165,-153,-146,-124,-81,0,0,0,0,0,0,0,0,0,0,0,0}, + {49,-90,126,-185,220,-250,300,-80,8246,9401,-10742,-3750,-1443,-2112,11413,4195,8007,20168,6210,-13329,-2849,1281,-14734,-12249,-1934,-3679,-6860,916,2799,-355,2145,4913,4205,2802,2451,7,-1226,-125,1588,89,-1474,-1337,-1770,-2870,-4332,-5136,-4118,-1217,620,417,888,2025,2678,2270,1305,910,733,254,-248,-366,-743,-934,-795,-1081,-1151,-720,-667,-805,-436,5,-39,104,519,759,549,141,-22,20,17,-130,-164,-450,-672,-526,-389,-349,-179,-13,-88,-190,48,330,342,252,112,-32,-93,-113,-231,-290,-336,-489,-495,-258,-24,83,2,-91,-95,-109,-134,-95,-99,-148,-98,-60,-40,-8,-8,-76,-137,-113,-51,23,62,25,9,-22,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 30 degrees, measured left/right ears + {-1,-2,1,-1,-2,0,1,0,3,-4,10,-16,25,-35,34,-26,59,174,2875,2628,-2396,212,-20,-1838,2842,3193,2169,5876,6521,-874,-1972,1757,-2635,-6051,-2259,-1399,-3721,-1934,203,-143,51,1544,1839,1285,1754,1560,354,307,745,-15,-687,-655,-756,-1267,-1622,-1571,-1376,-1067,-672,-381,-162,-10,67,96,50,81,186,88,-55,-53,-177,-401,-422,-423,-478,-324,-119,-93,-108,-41,-8,-30,8,70,9,-116,-183,-155,-182,-232,-184,-178,-222,-199,-129,-109,-76,-2,-15,-95,-89,-47,-68,-91,-77,-109,-147,-152,-160,-148,-127,-138,-149,-97,-49,-40,-54,-58,-38,-40,-63,-75,-97,-139,-168,-166,-155,-125,0,0,0,0,0,0,0,0,0,0,0,0}, + {-65,85,-117,100,-100,107,-157,4677,12934,-5141,-9586,-972,-2570,8977,6064,6250,19976,11079,-10305,-6181,1512,-11966,-13688,-4953,-3551,-6196,-818,3198,-66,1850,5051,4266,1809,2270,1211,-1101,-287,1686,563,-1166,-1149,-1491,-3100,-5226,-5550,-3397,-1384,-319,476,1295,1982,2404,2350,1609,1049,670,251,-214,-311,-611,-995,-932,-1025,-1243,-862,-599,-623,-443,-105,31,174,513,740,572,157,5,-44,-70,-161,-172,-390,-628,-521,-368,-347,-202,-21,-56,-183,-2,318,353,279,157,-30,-152,-121,-199,-292,-325,-481,-538,-326,-60,94,62,-45,-103,-119,-142,-86,-73,-163,-150,-90,-46,-18,-5,-72,-152,-159,-77,42,117,87,35,-6,-44,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 35 degrees, measured left/right ears + {-3,0,-1,0,0,-2,0,2,0,3,-5,12,-17,22,-28,28,-13,36,121,2283,2615,-1775,-73,332,-1610,2066,2898,1941,4912,6214,164,-1667,1611,-1674,-5234,-2466,-1244,-3387,-2203,39,-195,-124,1323,1811,1317,1635,1665,603,220,512,30,-480,-464,-717,-1348,-1716,-1646,-1440,-1277,-910,-511,-248,-13,231,383,284,222,269,190,-22,-143,-276,-488,-488,-471,-474,-345,-170,-103,-147,-65,24,36,30,71,43,-112,-185,-159,-168,-215,-200,-197,-244,-204,-117,-104,-74,10,14,-90,-104,-54,-78,-98,-90,-105,-139,-140,-133,-153,-158,-165,-145,-97,-78,-47,-41,-41,-17,-10,-44,-73,-82,-119,-148,-160,-159,0,0,0,0,0,0,0,0,0,0,0,0}, + {-6,13,-58,96,-144,148,1528,12621,3199,-12132,-4199,-1915,6430,6976,5100,18832,14721,-5820,-7357,343,-9073,-13237,-8202,-5108,-5012,-2836,2363,1290,1597,4907,4717,599,1874,2887,-834,-870,1474,1074,-709,-801,-1332,-3625,-5797,-5224,-2845,-1719,-1026,267,1511,2036,2060,2231,1905,1350,686,111,-244,-226,-523,-939,-982,-1111,-1263,-1004,-552,-488,-448,-236,90,347,567,712,544,204,37,-104,-233,-254,-147,-318,-578,-486,-339,-282,-196,-48,-64,-135,-28,239,364,310,182,-29,-192,-169,-214,-284,-298,-406,-530,-424,-121,112,142,-11,-108,-125,-141,-92,-68,-149,-179,-144,-87,-19,2,-68,-148,-165,-86,26,109,119,62,14,-28,16,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 40 degrees, measured left/right ears + {0,-1,0,0,0,1,-2,-1,3,-1,3,-3,9,-15,19,-23,23,-11,32,64,1704,2606,-1159,-368,674,-1357,1267,2618,1758,3952,5906,1266,-1385,1318,-719,-4408,-2659,-1035,-3008,-2534,-258,-108,-178,1085,1849,1423,1519,1554,662,200,475,252,-420,-770,-968,-1289,-1649,-1784,-1648,-1398,-937,-463,-147,159,461,579,495,322,264,163,-107,-294,-414,-526,-548,-508,-472,-379,-231,-130,-88,-6,73,56,35,68,40,-80,-176,-160,-169,-243,-237,-210,-227,-196,-123,-90,-74,-14,-8,-78,-99,-77,-75,-107,-87,-87,-117,-126,-151,-164,-171,-154,-156,-130,-81,-41,-20,-26,-6,-5,-37,-68,-82,-110,-142,-149,0,0,0,0,0,0,0,0,0,0,0,0}, + {75,-153,216,-272,345,-135,8950,10715,-9302,-9242,-2445,4537,7486,3612,17326,18210,-2091,-7364,186,-7004,-12302,-8904,-8213,-5348,-3181,492,1039,2289,5605,3804,258,2443,3347,-213,-632,577,961,-27,-291,-1474,-4251,-5740,-4601,-2843,-2035,-1026,146,1135,1918,1955,2034,1985,1633,843,28,-250,-213,-526,-889,-911,-1170,-1382,-1084,-501,-478,-458,-189,159,368,636,774,572,216,-26,-180,-325,-255,-177,-314,-522,-449,-288,-267,-185,0,-8,-83,-89,139,313,349,258,-24,-242,-251,-231,-298,-272,-317,-494,-468,-190,101,196,55,-75,-141,-141,-99,-75,-153,-211,-181,-130,-37,8,-34,-130,-173,-76,23,83,113,68,19,-29,4,77,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 45 degrees, measured left/right ears + {3,0,0,0,-1,1,1,-2,1,3,-3,7,-2,7,-8,16,-11,14,3,23,26,1190,2492,-524,-605,932,-1059,514,2319,1624,3100,5520,2294,-1072,997,163,-3476,-2673,-1059,-2833,-2648,-385,-54,-165,997,1838,1304,1268,1556,901,306,277,-20,-654,-961,-1016,-1282,-1729,-1872,-1616,-1257,-758,-276,21,345,622,696,540,329,206,4,-257,-417,-460,-565,-589,-533,-491,-364,-194,-64,-43,24,76,68,62,55,31,-55,-146,-192,-222,-256,-232,-188,-200,-186,-123,-102,-101,-55,-30,-70,-93,-49,-50,-82,-80,-70,-104,-148,-153,-159,-160,-176,-160,-123,-80,-26,-6,-1,-9,-11,-51,-82,-86,-109,-117,0,0,0,0,0,0,0,0,0,0,0,0}, + {-80,98,-104,109,-198,3827,14044,-1104,-13286,-4944,2536,7775,2651,13546,22171,2592,-7664,-94,-4166,-11388,-8443,-9890,-7349,-3719,-1140,553,1452,5620,3898,670,2462,3901,933,-410,61,579,408,-349,-1609,-4459,-5358,-4162,-3138,-2239,-1008,447,919,1299,1772,2000,1891,1684,1122,166,-220,-317,-465,-851,-956,-1093,-1502,-1270,-562,-355,-426,-171,230,406,620,771,657,233,-111,-221,-343,-262,-201,-289,-481,-457,-287,-280,-193,46,97,-11,-92,5,205,358,312,31,-249,-331,-296,-319,-262,-256,-429,-489,-284,47,224,131,-22,-133,-159,-108,-67,-138,-242,-253,-204,-77,10,-11,-90,-152,-95,18,87,98,58,0,-46,-30,53,92,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 50 degrees, measured left/right ears + {1,1,1,1,0,0,-1,-1,-1,-2,2,-2,3,-3,3,-6,7,-1,1,12,10,9,747,2260,103,-744,1051,-714,-144,1972,1545,2383,5004,3125,-616,738,1029,-2558,-2945,-1183,-2355,-2606,-596,104,-57,716,1561,1332,1353,1629,845,-215,-202,-104,-757,-1181,-1159,-1234,-1600,-1707,-1372,-959,-504,-116,175,448,627,662,471,215,32,-145,-367,-494,-488,-586,-618,-514,-412,-292,-131,-29,-53,0,100,95,34,35,29,-75,-183,-212,-214,-244,-230,-181,-193,-195,-148,-130,-130,-77,-25,-51,-74,-27,-27,-76,-69,-65,-126,-161,-153,-167,-183,-167,-148,-116,-73,-23,-5,-28,-38,-48,-67,-86,-73,-70,0,0,0,0,0,0,0,0,0,0,0,0}, + {-96,168,-246,290,244,10999,9628,-12128,-10351,547,6972,3446,7597,23880,10153,-7427,-1538,-865,-9970,-8329,-8904,-10121,-4762,-2397,-495,572,3954,3746,1495,2713,4449,2307,8,439,104,409,-230,-2171,-4597,-4793,-3754,-3650,-2555,-809,539,944,1060,1387,1743,1783,1674,1321,447,-118,-326,-434,-754,-995,-1134,-1529,-1487,-762,-235,-320,-156,239,496,582,709,701,285,-71,-179,-339,-392,-228,-163,-382,-526,-371,-266,-182,7,164,78,-28,-41,89,297,349,141,-221,-371,-348,-349,-291,-216,-326,-489,-384,-42,204,210,45,-105,-160,-115,-36,-90,-215,-296,-293,-185,-43,28,-22,-103,-124,-12,109,128,94,-7,-96,-95,35,110,57,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 55 degrees, measured left/right ears + {1,1,2,1,1,1,0,-1,0,0,0,1,-1,2,-2,2,-1,5,4,-5,21,-1,11,399,1909,685,-722,1001,-340,-640,1559,1503,1854,4345,3741,223,596,1292,-1735,-2800,-1278,-1916,-2420,-721,103,-165,562,1625,1563,1162,898,295,-403,-371,-385,-996,-1211,-1014,-982,-1280,-1353,-1047,-633,-284,-55,190,413,523,475,301,87,-138,-266,-398,-511,-523,-551,-517,-412,-303,-227,-125,-45,-47,13,67,68,25,-2,-19,-101,-161,-193,-202,-245,-249,-192,-195,-201,-165,-127,-112,-68,-35,-44,-45,-14,-19,-63,-66,-91,-125,-149,-165,-174,-172,-145,-135,-111,-87,-66,-51,-52,-46,-40,-46,-56,-54,0,0,0,0,0,0,0,0,0,0,0,0}, + {63,-70,90,-186,4017,15164,-1500,-16415,-3671,5699,5243,2443,19749,19864,-4110,-4649,1667,-6431,-9200,-7348,-10924,-6855,-3354,-1780,138,1055,3014,2356,2050,4273,4804,1149,292,689,558,-411,-2446,-4389,-4981,-3722,-3745,-3060,-940,567,1031,1071,1177,1420,1684,1536,1323,856,75,-276,-395,-624,-926,-1199,-1631,-1656,-966,-354,-227,-94,206,539,612,569,673,521,41,-210,-257,-461,-344,-133,-245,-502,-458,-275,-231,-55,187,181,25,-73,14,245,340,239,-102,-392,-421,-377,-311,-213,-245,-431,-462,-195,132,255,111,-55,-141,-140,-44,-27,-136,-271,-340,-314,-169,-16,24,-41,-120,-60,96,165,143,46,-98,-153,-83,74,114,37,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 60 degrees, measured left/right ears + {-1,0,0,1,1,1,0,-1,-2,-2,-1,-1,-1,-1,-1,-2,-3,5,1,2,-10,28,-5,5,173,1467,1149,-504,779,-1,-913,1112,1459,1525,3749,4211,901,289,1577,-695,-2590,-1450,-1407,-2205,-1031,74,213,695,1286,1002,365,372,99,-661,-748,-526,-835,-983,-675,-570,-863,-1007,-716,-418,-264,-109,92,251,305,269,114,-79,-225,-302,-419,-487,-428,-402,-398,-313,-232,-210,-140,-60,-37,-33,3,36,-12,-41,-46,-86,-136,-197,-219,-252,-255,-196,-181,-174,-139,-111,-104,-74,-32,-41,-40,-17,-26,-57,-76,-73,-109,-149,-161,-175,-157,-147,-153,-148,-130,-86,-53,-27,-20,-16,-33,-57,0,0,0,0,0,0,0,0,0,0,0,0}, + {153,-244,324,-131,9824,12990,-12926,-13589,3455,6825,1523,9742,25761,6266,-8315,1161,-941,-8698,-7135,-9485,-9865,-3944,-2898,-758,-669,850,2563,1673,3089,5304,3869,1065,1087,1004,172,-2393,-4211,-4831,-4396,-3896,-3667,-1570,497,1113,1027,1145,1253,1507,1485,1294,1094,428,-166,-266,-461,-930,-1131,-1509,-1826,-1398,-594,-162,-67,180,405,586,571,606,686,336,-104,-269,-373,-463,-236,-170,-398,-476,-345,-260,-173,122,256,115,-32,-60,123,341,344,73,-310,-491,-437,-327,-223,-180,-321,-483,-395,-36,241,200,23,-109,-157,-88,21,-34,-191,-318,-378,-290,-117,-8,-11,-85,-100,45,181,174,114,-17,-138,-141,-25,88,62,12,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 65 degrees, measured left/right ears + {3,3,3,5,4,5,5,4,4,3,5,6,6,5,8,3,9,4,15,7,6,13,33,-7,14,68,1006,1434,-91,448,262,-880,645,1492,1627,2900,3888,1910,610,1588,93,-2078,-1605,-1214,-1796,-813,330,169,-20,336,510,36,-234,-390,-689,-601,-423,-516,-448,-199,-203,-509,-704,-562,-368,-349,-282,-76,49,79,45,-23,-136,-263,-292,-290,-308,-294,-281,-275,-228,-183,-197,-158,-78,-68,-83,-42,-8,-18,-38,-53,-73,-127,-188,-220,-224,-202,-159,-127,-129,-119,-103,-81,-65,-48,-31,-36,-16,-11,-27,-42,-56,-88,-138,-158,-172,-180,-170,-161,-146,-112,-60,-22,0,3,-17,-37,0,0,0,0,0,0,0,0,0,0,0,0}, + {116,-197,199,1378,14950,5372,-19967,-6418,7991,4281,1581,19625,21034,-5281,-4670,3557,-4224,-8157,-7258,-10748,-7080,-2874,-1888,-1374,-1997,1924,1988,1334,4082,5609,2772,1277,2142,1182,-1426,-4062,-4262,-4627,-4506,-4236,-2753,-287,1134,1251,922,1093,1424,1531,1260,1237,870,60,-242,-186,-693,-1262,-1334,-1574,-1763,-1186,-339,-5,70,283,478,504,600,813,607,92,-159,-210,-486,-445,-152,-240,-487,-462,-268,-241,-58,230,232,35,-55,7,212,366,284,-92,-443,-483,-406,-268,-158,-179,-394,-516,-291,83,258,131,-44,-163,-139,5,41,-67,-256,-369,-352,-222,-70,-18,-55,-129,-41,141,186,146,87,-35,-149,-93,45,51,12,-17,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 70 degrees, measured left/right ears + {0,0,0,0,1,2,2,1,2,0,-1,1,0,-1,3,1,-1,6,-6,14,-1,5,13,13,-4,2,27,582,1472,412,136,368,-565,544,1366,1104,2198,3875,2902,1000,1347,693,-1521,-1674,-638,-901,-980,-566,-618,-597,-193,-81,-620,-730,-345,-285,-368,-153,33,76,143,7,-340,-562,-556,-506,-563,-480,-298,-218,-137,-105,-110,-176,-200,-141,-129,-188,-214,-180,-194,-207,-208,-223,-198,-173,-143,-133,-96,-43,-53,-67,-80,-82,-128,-193,-189,-169,-149,-135,-129,-125,-126,-101,-113,-106,-73,-43,-17,-22,-15,-31,-36,-65,-124,-163,-198,-198,-197,-179,-164,-132,-86,-69,-36,-15,-19,-43,0,0,0,0,0,0,0,0,0,0,0,0}, + {-21,20,-133,4195,17381,-4118,-21438,1073,9223,1060,6071,25499,10798,-10026,461,3363,-6039,-7571,-8292,-10271,-4770,-2198,-1740,-3303,-1736,2919,1340,1522,4909,4985,1921,2061,2341,610,-2608,-4305,-4037,-4558,-4691,-4142,-1769,392,1286,1097,801,1103,1553,1468,1219,1207,536,-103,-156,-300,-992,-1356,-1398,-1683,-1613,-886,-190,-60,67,355,514,466,682,921,486,-56,-119,-259,-545,-333,-116,-364,-573,-435,-276,-207,77,296,152,-17,-28,75,250,335,157,-248,-482,-438,-330,-213,-147,-246,-483,-518,-171,187,209,31,-113,-179,-103,41,27,-129,-303,-396,-326,-166,-32,-26,-107,-145,-10,156,158,135,54,-84,-129,-22,76,28,-43,-97,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 75 degrees, measured left/right ears + {0,0,-1,-1,0,0,1,1,2,1,0,0,0,0,0,0,-1,0,3,-6,15,3,-6,19,13,-5,-3,13,281,1330,919,-10,608,124,-172,806,1366,1921,3496,3618,1507,1019,1166,-322,-1081,-599,-1161,-1951,-1450,-952,-1068,-996,-737,-762,-571,-28,155,108,249,464,488,307,7,-309,-535,-692,-730,-753,-702,-536,-380,-253,-178,-102,-54,-24,-5,-21,-85,-132,-125,-160,-223,-249,-276,-279,-234,-180,-158,-137,-92,-71,-83,-87,-88,-91,-107,-128,-120,-130,-135,-121,-127,-139,-148,-136,-100,-55,-25,-24,-25,-27,-35,-72,-104,-134,-173,-194,-203,-183,-166,-134,-114,-114,-83,-53,-27,-40,0,0,0,0,0,0,0,0,0,0,0,0}, + {-176,270,-431,7424,17046,-12260,-19326,6706,8448,-860,12085,26119,906,-9926,4561,2537,-7126,-7332,-8828,-9327,-3011,-1682,-3033,-4861,-363,3199,664,2396,5348,3856,1557,2657,1952,-509,-2916,-3470,-3705,-4904,-4686,-3371,-1263,460,1243,830,603,1200,1647,1337,1257,1215,278,-239,-24,-350,-1199,-1358,-1420,-1720,-1466,-625,-136,-175,-44,435,542,463,775,920,411,-82,-85,-355,-518,-168,-125,-501,-628,-385,-280,-168,198,295,83,-48,13,114,272,320,29,-357,-479,-344,-221,-160,-170,-343,-546,-443,-43,232,124,-51,-161,-180,-53,54,9,-174,-338,-390,-273,-102,12,-9,-160,-183,26,178,155,103,17,-106,-84,69,88,-18,-94,-129,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 80 degrees, measured left/right ears + {0,-1,-1,-1,-1,-1,0,-1,1,0,0,-1,0,2,0,0,-1,-1,1,1,1,11,1,-2,30,9,-14,-11,-1,160,1113,1465,446,194,27,-13,824,1278,1675,3090,3838,2251,1515,1957,403,-1510,-1616,-1695,-2315,-2118,-1638,-1552,-1347,-850,-464,-165,368,668,559,572,732,644,261,-118,-385,-653,-874,-963,-944,-852,-653,-459,-288,-83,35,101,101,78,53,-29,-72,-121,-188,-296,-320,-295,-307,-264,-232,-196,-165,-115,-87,-93,-53,-14,-14,-68,-103,-105,-121,-137,-148,-158,-169,-150,-113,-91,-62,-38,-28,-49,-63,-69,-91,-110,-143,-172,-188,-174,-156,-161,-148,-131,-124,-107,-69,-33,0,0,0,0,0,0,0,0,0,0,0,0}, + {-280,436,-554,10004,15367,-17574,-16314,10087,7182,-1280,16883,23784,-6108,-7995,7633,1713,-8023,-6816,-8944,-8650,-1614,-1581,-5004,-5627,1340,2906,-126,3603,5662,2695,1429,2905,1021,-1463,-2472,-2527,-3575,-4844,-4278,-3046,-880,539,749,487,639,1193,1491,1301,1400,1071,64,-199,99,-414,-1178,-1325,-1501,-1686,-1315,-484,-174,-271,-105,406,519,489,841,915,316,-58,-80,-402,-447,-70,-153,-602,-636,-351,-258,-117,231,250,19,-60,23,122,300,283,-49,-426,-454,-270,-161,-106,-187,-414,-594,-378,53,222,54,-125,-220,-191,-18,70,-36,-215,-358,-354,-207,-57,23,-52,-197,-175,61,178,122,74,-21,-116,-59,93,75,-45,-109,-165,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 85 degrees, measured left/right ears + {1,0,-1,-1,-1,0,0,0,1,2,2,1,1,1,0,1,-2,-1,0,3,3,-4,14,8,7,23,2,-30,-9,54,293,1401,1473,-87,212,798,226,514,1106,1445,2691,4504,3838,1831,1138,-114,-2028,-2186,-2022,-2869,-2806,-1941,-1483,-1233,-654,-23,360,743,1022,905,727,744,554,114,-338,-596,-786,-1048,-1112,-1025,-908,-687,-390,-120,44,148,191,168,111,82,21,-110,-191,-249,-305,-325,-318,-320,-316,-267,-211,-173,-114,-43,-17,4,35,7,-49,-87,-116,-130,-149,-163,-170,-157,-130,-113,-104,-90,-51,-37,-62,-74,-88,-101,-113,-125,-152,-165,-145,-157,-167,-163,-154,-130,-78,-25,0,0,0,0,0,0,0,0,0,0,0,0}, + {-329,516,-589,11258,14119,-20135,-14312,11778,6384,-1031,19298,21206,-10200,-6273,10222,1278,-8867,-5915,-8809,-8480,-558,-1790,-7025,-5650,2667,2098,-277,4354,5522,2451,1296,2619,90,-1921,-1853,-1920,-3506,-4399,-3570,-2943,-842,600,487,-9,558,1256,1225,1215,1499,963,-88,-101,268,-424,-1121,-1201,-1503,-1740,-1185,-358,-256,-345,-125,336,464,514,865,889,281,-53,-84,-379,-393,-22,-170,-633,-599,-303,-232,-91,254,179,-56,-69,22,144,300,251,-91,-421,-420,-253,-110,-45,-167,-455,-614,-333,98,220,2,-179,-261,-198,-4,65,-51,-234,-337,-307,-184,-31,26,-72,-192,-142,66,173,135,56,-58,-150,-56,93,77,-38,-125,-183,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 90 degrees, measured left/right ears + {0,-1,-1,-1,-1,-1,-1,0,-1,1,0,-1,1,0,-1,0,-3,-2,-2,3,1,-3,5,17,8,1,14,-17,-17,142,652,557,356,1077,804,509,932,639,379,581,1414,3573,5326,3672,748,-99,-453,-1911,-2745,-2775,-3069,-2714,-1804,-1237,-863,-252,404,726,1007,1192,1025,678,534,361,-178,-598,-774,-892,-1080,-1175,-1030,-821,-496,-222,-30,127,197,220,167,118,30,-50,-129,-220,-251,-323,-346,-341,-344,-352,-298,-175,-99,-45,-14,15,41,37,-16,-73,-89,-103,-130,-168,-193,-164,-147,-163,-151,-116,-74,-54,-51,-73,-98,-93,-104,-114,-126,-133,-138,-155,-170,-195,-172,-112,-56,-26,0,0,0,0,0,0,0,0,0,0,0,0}, + {-335,531,-666,11016,14274,-20450,-14263,12368,6401,-801,19447,19852,-12004,-5756,12468,1733,-9639,-5131,-8237,-8810,85,-2066,-8668,-5494,3117,1712,-260,4570,5301,2338,1627,2189,-842,-1992,-1338,-1702,-3319,-3868,-3063,-2585,-812,342,377,-215,265,1103,1114,1065,1393,929,-46,-95,322,-262,-1020,-1130,-1409,-1717,-1222,-280,-226,-397,-211,273,410,477,842,837,272,-36,-70,-360,-378,3,-131,-616,-560,-251,-219,-103,254,128,-151,-100,40,131,284,246,-105,-429,-382,-195,-60,-30,-174,-450,-620,-324,100,208,-37,-213,-289,-228,-13,73,-31,-230,-347,-326,-174,2,46,-72,-203,-152,84,193,130,18,-104,-176,-72,82,65,-52,-127,-156,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 95 degrees, measured left/right ears + {-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,1,0,0,1,-1,-3,-2,-2,2,-3,1,6,11,9,12,-10,-2,49,554,765,-72,-138,776,1294,1027,825,1467,1419,-467,26,2826,4048,3905,2227,55,-618,-625,-1994,-3244,-3004,-2552,-2270,-1626,-746,-351,-7,597,984,1137,1103,862,493,290,-9,-454,-774,-829,-853,-1084,-1087,-841,-556,-363,-162,37,146,197,150,86,47,19,-45,-155,-243,-300,-311,-351,-396,-373,-294,-183,-111,-58,-24,7,18,6,-21,-52,-38,-56,-128,-171,-187,-200,-199,-175,-154,-144,-109,-87,-76,-61,-71,-100,-124,-125,-108,-110,-132,-155,-164,-164,-151,-100,-46,-28,0,0,0,0,0,0,0,0,0,0,0,0}, + {-302,463,-692,9276,15697,-18346,-16300,11923,7260,-853,17710,19991,-11665,-6850,14080,3568,-10173,-4957,-7112,-9372,91,-2034,-9688,-5798,2744,2048,-209,4127,5276,2409,1691,2229,-1291,-2356,-868,-1539,-3133,-3529,-2644,-2285,-687,297,79,-390,276,862,797,991,1299,836,16,-51,310,-144,-877,-985,-1340,-1652,-1221,-308,-179,-379,-300,197,373,431,767,758,274,-18,-46,-329,-390,8,-54,-538,-531,-232,-174,-132,204,113,-172,-177,-1,117,257,252,-88,-394,-344,-157,-36,-8,-172,-446,-595,-321,67,182,-38,-240,-327,-231,-6,96,-31,-262,-368,-325,-158,27,68,-79,-203,-129,94,182,102,-7,-105,-187,-108,35,40,-37,-102,-136,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 100 degrees, measured left/right ears + {1,0,-1,-1,0,0,0,0,0,0,0,1,2,1,3,1,1,-1,1,1,-1,4,10,5,14,11,6,-2,443,965,148,-379,298,587,543,1101,1862,2206,1974,24,-1028,1320,2929,2420,2028,1455,-37,-819,-904,-2089,-2978,-2560,-2038,-1748,-1055,-440,-237,178,790,1023,923,828,643,267,-76,-342,-602,-694,-747,-827,-891,-803,-608,-452,-276,-106,33,66,48,81,95,74,-1,-110,-204,-240,-267,-354,-390,-310,-221,-199,-146,-69,-30,-35,-42,-25,-14,-21,-29,-46,-86,-153,-207,-215,-192,-161,-148,-162,-157,-109,-70,-65,-75,-88,-114,-123,-114,-118,-124,-110,-104,-111,-97,-81,-52,-30,0,0,0,0,0,0,0,0,0,0,0,0}, + {-180,258,-491,6236,17321,-13108,-19957,9776,9141,-1047,14315,21126,-8941,-9433,14288,7077,-9974,-5756,-5587,-9782,-719,-1488,-10054,-6717,1744,2686,44,3280,5205,2694,1794,2172,-1098,-2599,-885,-1305,-2716,-3507,-2489,-1874,-715,308,108,-540,38,840,683,705,1133,916,48,-141,294,-9,-777,-853,-1190,-1572,-1227,-300,-154,-365,-300,123,294,362,696,716,264,-41,-9,-247,-404,-33,47,-447,-503,-233,-145,-154,165,130,-173,-202,-66,63,218,284,-7,-338,-331,-149,-11,27,-148,-420,-596,-339,45,183,-40,-259,-307,-224,-2,89,-44,-271,-358,-290,-166,-6,78,-25,-146,-129,47,143,117,21,-110,-208,-147,25,51,-22,-83,-111,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 105 degrees, measured left/right ears + {1,0,2,1,0,2,0,0,1,0,0,0,0,2,1,1,1,1,0,1,-2,13,-1,9,14,13,1,296,1079,478,-494,97,562,321,323,1018,2638,3235,1501,194,-118,-60,773,1232,1123,1205,1073,92,-864,-1083,-1578,-2313,-2070,-1364,-1182,-932,-485,5,370,586,728,692,562,286,-46,-316,-420,-469,-568,-630,-632,-624,-610,-512,-344,-262,-206,-105,3,52,83,84,-8,-85,-133,-178,-259,-279,-251,-246,-219,-174,-128,-111,-106,-86,-79,-42,-10,-41,-67,-59,-76,-142,-174,-174,-165,-159,-175,-185,-166,-119,-83,-86,-93,-85,-91,-124,-140,-124,-90,-53,-46,-48,-61,-61,-57,-55,0,0,0,0,0,0,0,0,0,0,0,0}, + {32,-98,33,2623,17173,-4233,-23233,4501,11818,-564,9169,22076,-3299,-12545,11944,11845,-7956,-7704,-4056,-9512,-2548,-526,-9555,-8195,191,3086,575,2252,5006,3126,1858,2324,-581,-2892,-936,-1073,-2339,-3313,-2694,-1699,-709,264,138,-424,-173,598,742,684,827,863,256,-228,77,116,-647,-818,-1049,-1380,-1228,-397,-58,-312,-340,47,260,263,572,708,309,-98,-18,-144,-373,-126,120,-327,-517,-267,-133,-152,102,166,-154,-240,-100,1,157,304,82,-262,-343,-156,-13,45,-121,-381,-563,-413,-18,171,9,-240,-287,-227,-93,51,6,-192,-344,-346,-209,-41,109,37,-135,-178,-10,156,128,6,-127,-199,-146,7,59,-9,-75,-83,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 110 degrees, measured left/right ears + {0,0,1,1,1,1,0,0,0,0,-1,1,0,0,3,1,1,2,3,-4,4,11,-2,10,14,10,170,1106,889,-544,-176,636,335,79,727,2240,2955,2065,1332,715,114,-278,-904,-439,458,640,896,923,246,-565,-822,-1032,-1411,-1497,-1243,-1053,-812,-310,-30,125,333,479,372,127,14,-93,-251,-317,-317,-378,-475,-472,-460,-469,-505,-455,-319,-226,-85,-19,-5,3,-12,-55,-126,-121,-107,-146,-186,-190,-167,-152,-130,-165,-171,-130,-78,-60,-88,-79,-106,-120,-95,-82,-98,-121,-141,-187,-206,-180,-148,-135,-119,-100,-99,-98,-120,-132,-114,-82,-60,-34,-10,-4,-18,-48,-73,-97,0,0,0,0,0,0,0,0,0,0,0,0}, + {223,-394,520,-23,13468,6429,-22276,-4648,13466,2211,2993,20576,5183,-14015,6317,16063,-2923,-10018,-3656,-7877,-5137,-52,-7700,-9750,-2074,2987,1310,1264,4505,3730,1959,2359,551,-3014,-1640,-485,-1837,-3210,-2920,-1694,-873,163,204,-306,-256,454,682,696,801,764,333,-166,-132,63,-530,-810,-897,-1185,-1189,-537,-1,-167,-350,-120,258,227,417,663,432,-91,-100,-42,-292,-225,101,-177,-532,-348,-125,-129,23,182,-85,-259,-128,20,101,260,167,-152,-319,-190,-34,25,-80,-304,-511,-478,-130,153,92,-164,-299,-304,-144,70,98,-124,-352,-399,-238,-28,80,19,-127,-160,-27,127,95,-7,-76,-139,-150,-22,75,29,-46,-69,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 115 degrees, measured left/right ears + {1,1,1,3,1,2,2,0,1,0,1,2,-1,1,3,1,2,3,5,-4,9,2,11,5,27,72,1032,1344,-434,-554,636,448,-30,519,2287,3259,1959,887,939,874,118,-942,-1297,-1181,-674,194,581,827,1121,557,-247,-187,-357,-1170,-1492,-1103,-770,-780,-539,-215,-61,35,67,11,41,122,25,-118,-148,-160,-276,-353,-380,-465,-530,-510,-390,-283,-233,-161,-111,-87,-92,-68,-13,24,7,-70,-136,-116,-94,-139,-172,-172,-169,-158,-130,-118,-148,-175,-157,-111,-81,-62,-43,-74,-140,-196,-195,-165,-150,-130,-127,-125,-122,-132,-135,-109,-66,-42,-34,-25,5,23,-3,-49,-98,-124,0,0,0,0,0,0,0,0,0,0,0,0}, + {190,-300,390,-558,6871,13993,-13693,-14945,10424,7614,-1319,14160,14286,-10705,-1801,16939,4937,-10370,-5564,-5169,-7056,-1350,-4800,-10104,-5201,1957,2247,513,3459,4362,2352,2092,1744,-2038,-2832,-561,-864,-2810,-3358,-1833,-993,-211,183,-90,-315,268,767,672,705,874,496,-187,-268,-25,-457,-898,-792,-945,-1129,-734,-16,-20,-269,-248,153,256,278,574,543,25,-182,0,-178,-305,-17,-66,-505,-448,-160,-117,-75,155,33,-217,-155,29,95,177,208,-21,-267,-243,-92,-8,-59,-229,-430,-522,-246,96,140,-149,-310,-271,-138,56,89,-78,-297,-347,-268,-134,-18,10,-61,-133,-96,37,84,40,-17,-92,-143,-55,87,77,-13,-66,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 120 degrees, measured left/right ears + {1,1,1,3,2,1,0,-1,0,0,1,1,-1,2,1,2,1,8,-3,9,-5,16,-4,39,23,869,1751,-115,-974,491,641,-129,313,2483,3671,2096,886,829,354,33,-471,-1274,-1339,-1105,-1065,-584,303,927,1071,1131,1055,429,-153,-517,-1041,-1184,-982,-928,-914,-684,-477,-405,-328,-68,155,210,227,149,48,-26,-130,-311,-390,-395,-414,-451,-467,-402,-332,-280,-279,-246,-84,51,71,59,40,3,-44,-71,-74,-96,-143,-175,-183,-188,-188,-215,-243,-217,-151,-95,-84,-48,-39,-87,-134,-164,-162,-150,-137,-126,-126,-154,-167,-142,-108,-69,-47,-42,-20,7,10,-4,-30,-69,-110,-134,0,0,0,0,0,0,0,0,0,0,0,0}, + {-50,113,-206,216,1171,13676,555,-19514,563,12151,148,3983,18232,-526,-8836,12129,12970,-6087,-9157,-3437,-6534,-4268,-2879,-8152,-8001,-820,2973,593,1769,4478,3303,1818,2120,-29,-3106,-1674,-415,-1759,-3343,-2450,-1183,-511,-64,-45,-134,29,698,819,646,806,807,34,-443,-220,-262,-904,-921,-785,-954,-899,-238,102,-144,-241,7,265,176,409,613,257,-175,-42,-55,-327,-214,-46,-389,-555,-271,-123,-147,53,142,-91,-157,5,107,139,207,80,-178,-294,-167,-63,-53,-172,-345,-484,-367,-71,52,-55,-200,-195,-170,-57,54,20,-156,-329,-356,-242,-85,11,-49,-164,-170,-7,110,68,11,-47,-97,-69,70,104,12,-47,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 125 degrees, measured left/right ears + {1,1,2,1,1,0,-1,0,-1,-1,-2,-1,1,-2,1,-4,8,-6,6,-5,10,-3,26,16,674,2053,375,-1359,205,826,-130,79,2608,4260,2342,783,934,328,-298,-961,-1665,-1263,-954,-1099,-907,-600,95,721,984,1417,1577,957,120,-267,-376,-852,-1215,-1099,-1054,-1104,-1001,-818,-500,-100,145,253,329,379,254,4,-129,-197,-287,-328,-373,-426,-465,-459,-440,-468,-378,-158,-28,12,33,72,68,11,12,26,-20,-95,-124,-177,-198,-205,-268,-308,-281,-182,-149,-126,-71,-56,-84,-132,-131,-128,-112,-100,-119,-143,-164,-154,-157,-134,-85,-54,-45,-42,-6,0,-23,-46,-74,-97,-119,-129,0,0,0,0,0,0,0,0,0,0,0,0}, + {-133,219,-310,363,-484,6637,11530,-12096,-11947,9746,6944,-2743,11676,12332,-8032,1950,16447,3166,-10723,-5212,-3657,-6464,-3678,-5239,-8365,-4691,1952,1751,200,3497,4288,2294,1657,1541,-1550,-2673,-1016,-1004,-2505,-2864,-1675,-962,-297,-172,-75,0,465,892,744,703,914,460,-357,-456,-186,-611,-1060,-887,-829,-881,-569,5,12,-136,-72,229,193,154,499,547,42,-134,-7,-256,-402,-166,-224,-585,-477,-174,-144,-91,145,86,-79,-17,108,120,182,146,-75,-277,-267,-124,-62,-114,-275,-427,-505,-295,11,80,-89,-204,-206,-118,57,102,-94,-329,-372,-262,-158,-100,-92,-159,-167,-56,90,99,35,-7,-39,-51,21,100,55,-39,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 130 degrees, measured left/right ears + {1,2,2,1,0,-1,0,-1,1,-1,-2,1,-2,4,-3,4,1,2,0,6,6,13,25,491,2248,998,-1646,-247,980,-54,-140,2737,4890,2625,728,1083,310,-510,-1069,-2132,-1997,-1179,-946,-921,-564,130,197,283,1146,1550,1162,943,642,135,-223,-496,-869,-1276,-1327,-1332,-1395,-1040,-470,-172,5,284,473,342,234,171,13,-130,-215,-288,-400,-413,-411,-506,-558,-392,-207,-165,-139,-60,35,26,12,81,115,77,-18,-103,-144,-160,-166,-236,-310,-306,-255,-187,-150,-124,-95,-99,-129,-160,-126,-76,-52,-65,-119,-159,-166,-137,-111,-87,-73,-66,-42,-31,-30,-45,-72,-92,-109,-106,-104,-112,0,0,0,0,0,0,0,0,0,0,0,0}, + {41,-81,130,-211,249,578,10869,3222,-15834,-1745,11507,324,-319,15663,4010,-6362,10895,12916,-5579,-9573,-2103,-5075,-6442,-3962,-6442,-7069,-1401,2459,230,1220,4572,3461,1486,1665,646,-2148,-1921,-1013,-1697,-2638,-2082,-1339,-951,-314,-93,-36,217,793,912,702,813,803,55,-500,-284,-270,-892,-1019,-863,-849,-792,-290,75,-8,-69,122,300,115,222,543,408,-49,-55,-124,-443,-396,-178,-412,-628,-361,-144,-157,47,221,65,-22,93,156,141,169,41,-184,-308,-186,-62,-92,-261,-430,-470,-364,-95,49,-52,-172,-145,-54,6,34,-34,-199,-315,-329,-238,-190,-144,-103,-130,-110,27,135,81,31,27,-10,-18,72,87,-30,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 135 degrees, measured left/right ears + {3,0,0,-1,-1,-1,-1,-1,-1,-3,1,-1,0,-2,2,2,-3,2,-5,17,-7,44,337,2314,1682,-1770,-816,1054,49,-333,2888,5560,2932,611,1246,436,-771,-1212,-2378,-2558,-1502,-1221,-1253,-635,354,521,340,796,1073,911,796,724,682,481,5,-340,-625,-1128,-1554,-1588,-1318,-923,-611,-282,-3,157,309,357,325,248,66,-87,-189,-307,-390,-432,-425,-398,-364,-283,-219,-229,-178,-128,-95,-25,86,148,95,17,-47,-120,-148,-118,-160,-250,-288,-250,-202,-201,-176,-140,-150,-168,-171,-149,-98,-42,-39,-96,-147,-147,-119,-100,-65,-47,-68,-86,-73,-56,-81,-112,-129,-131,-116,-102,-93,-98,0,0,0,0,0,0,0,0,0,0,0,0}, + {53,-79,97,-111,113,-199,3242,11060,-4614,-12920,5621,8287,-4177,4946,15135,-1389,-652,14743,5605,-9948,-5477,-1440,-7134,-5995,-4086,-6973,-4891,757,1513,-237,2632,4731,2396,1121,1575,-215,-2089,-1375,-1318,-2096,-2299,-1618,-1313,-957,-284,-76,21,483,955,855,717,840,549,-154,-396,-191,-501,-988,-892,-836,-870,-642,-135,37,-7,28,256,288,153,331,463,160,-93,-21,-275,-541,-356,-268,-572,-569,-239,-134,-83,188,224,47,58,167,142,117,116,-59,-219,-218,-152,-187,-238,-289,-358,-404,-309,-121,-21,-50,-65,-53,-49,-6,1,-98,-267,-348,-313,-221,-155,-106,-106,-121,-32,98,125,72,52,37,-16,-11,48,20,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 140 degrees, measured left/right ears + {1,0,-1,-2,-1,-1,-1,0,-2,-1,0,0,0,-1,5,-5,8,-13,22,-17,58,225,2314,2352,-1737,-1447,1055,205,-546,3039,6299,3275,487,1381,554,-971,-1323,-2607,-3085,-1806,-1346,-1490,-1001,176,741,572,1081,1325,628,278,511,497,364,409,345,-199,-751,-1025,-1380,-1436,-1038,-779,-647,-487,-133,126,197,336,308,159,50,-41,-238,-363,-301,-240,-317,-336,-213,-191,-251,-265,-225,-180,-126,-12,90,85,30,-32,-116,-123,-76,-105,-199,-223,-168,-163,-187,-190,-174,-191,-210,-193,-169,-113,-53,-55,-119,-146,-126,-93,-39,-6,-24,-76,-102,-90,-84,-110,-142,-142,-144,-138,-106,-86,-85,-99,0,0,0,0,0,0,0,0,0,0,0,0}, + {-53,80,-115,141,-196,239,-232,5809,8409,-9083,-7461,8812,2867,-4882,9929,12148,-3026,5152,13618,-1474,-9506,-1812,-3273,-8477,-4734,-4574,-6767,-2597,1477,434,261,3838,3984,1568,1185,1198,-806,-1769,-1142,-1529,-2025,-2033,-1514,-1325,-830,-350,-180,166,726,949,739,785,834,375,-198,-285,-248,-688,-957,-754,-734,-800,-576,-106,-23,-16,138,347,267,197,373,282,-87,-130,-34,-363,-558,-352,-377,-604,-417,-124,-120,-40,234,203,83,120,135,66,102,105,-92,-262,-251,-161,-164,-229,-337,-430,-442,-266,-47,6,-59,-48,-14,-25,-53,-97,-198,-295,-303,-238,-172,-154,-112,-93,-60,23,107,107,64,43,-8,-50,-9,29,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 145 degrees, measured left/right ears + {0,-3,-3,-2,-3,-1,-2,-2,-3,0,-1,0,-3,6,-11,14,-21,27,-30,63,148,2273,2986,-1603,-2110,969,404,-747,3204,7097,3560,353,1607,644,-1294,-1416,-2702,-3620,-2176,-1401,-1714,-1267,126,706,476,1263,1651,883,361,253,91,66,133,216,165,-215,-753,-1057,-935,-752,-783,-842,-662,-375,-175,-20,97,155,113,41,-52,-185,-155,-78,-165,-272,-238,-138,-134,-218,-261,-238,-212,-194,-132,-39,-2,-23,-61,-102,-117,-79,-91,-153,-164,-114,-105,-147,-155,-143,-181,-228,-214,-192,-146,-105,-116,-154,-171,-147,-75,13,42,-1,-83,-129,-120,-102,-116,-145,-157,-164,-159,-122,-90,-86,-103,-116,0,0,0,0,0,0,0,0,0,0,0,0}, + {9,-34,48,-76,101,-152,179,257,7360,4906,-10277,-2066,8086,-1866,-2476,12847,8769,-1897,8775,9430,-5509,-6458,-596,-6036,-8041,-3689,-5399,-5574,-1078,1226,-25,1254,4379,2897,1093,1282,869,-1211,-1481,-986,-1441,-1846,-1874,-1503,-1417,-729,-453,-264,270,837,904,695,841,863,325,-211,-237,-343,-796,-800,-612,-675,-718,-459,-164,-95,57,223,323,168,187,331,167,-216,-210,-147,-400,-447,-300,-422,-535,-264,-76,-123,7,232,168,102,128,91,20,61,12,-109,-146,-126,-174,-273,-342,-390,-410,-360,-191,-39,-3,-31,-28,-53,-90,-118,-143,-194,-227,-228,-206,-181,-136,-68,-46,-25,44,94,64,28,4,-26,-44,-12,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 150 degrees, measured left/right ears + {-1,-3,-1,-2,-3,-1,-3,-3,0,-2,4,-6,9,-15,15,-24,33,-35,62,91,2210,3574,-1358,-2763,770,650,-923,3330,7987,3846,133,1870,869,-1697,-1634,-2693,-4095,-2571,-1447,-1896,-1506,42,780,486,1227,1797,1047,406,463,212,-273,-257,-45,-114,-362,-435,-638,-703,-429,-401,-514,-560,-423,-293,-275,-155,-67,-118,-246,-188,-50,10,-14,-58,-141,-190,-84,-62,-131,-182,-173,-209,-259,-167,-68,-116,-165,-117,-135,-163,-94,-65,-121,-138,-87,-90,-122,-78,-71,-130,-161,-183,-196,-176,-153,-170,-217,-212,-149,-66,13,54,5,-94,-150,-133,-93,-90,-123,-159,-169,-157,-124,-97,-101,-111,-114,-97,0,0,0,0,0,0,0,0,0,0,0,0}, + {12,-10,-4,13,-37,50,-85,74,950,7867,1849,-9158,1426,5057,-4049,887,13529,6462,370,9442,4968,-6182,-3565,-1722,-7774,-6503,-3670,-5692,-4085,-498,733,169,2294,4138,1968,914,1340,438,-1328,-1182,-998,-1139,-1581,-1764,-1641,-1508,-711,-549,-325,300,858,879,729,872,880,320,-209,-228,-373,-755,-689,-575,-609,-621,-334,-132,-101,49,140,157,63,160,218,24,-210,-162,-219,-450,-352,-200,-380,-412,-176,-96,-148,30,191,119,110,87,-36,-37,120,106,-32,-147,-195,-257,-305,-344,-392,-385,-286,-128,-57,-60,-58,-55,-97,-129,-113,-106,-149,-190,-211,-187,-151,-86,-32,-24,-16,23,46,16,8,-8,-56,-60,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 155 degrees, measured left/right ears + {-3,-2,-2,-1,0,-3,-2,3,-1,4,-6,11,-17,18,-25,32,-30,59,53,2133,4095,-1033,-3363,486,882,-1043,3412,8902,4175,-138,2127,1154,-2057,-1998,-2646,-4467,-3080,-1446,-2013,-1779,11,867,431,1269,2000,1120,360,460,325,-162,-293,-333,-458,-599,-678,-722,-585,-208,11,-82,-164,-155,-211,-299,-244,-260,-477,-531,-264,-119,-152,-24,37,-66,-131,-29,57,-38,-118,-116,-153,-200,-149,-99,-147,-186,-216,-288,-283,-106,-15,-121,-157,-107,-75,-75,-46,-10,-41,-84,-125,-181,-194,-162,-172,-226,-240,-190,-100,-10,23,-46,-151,-175,-119,-58,-55,-93,-140,-164,-144,-116,-101,-106,-130,-133,-101,-48,0,0,0,0,0,0,0,0,0,0,0,0}, + {-12,25,-27,18,-17,3,3,-20,-1,1592,7638,-111,-7013,2433,1929,-3859,3438,12907,5687,2213,8024,2063,-4940,-2265,-3677,-7768,-5243,-4241,-5200,-2976,-453,442,708,2916,3463,1454,1060,1126,-52,-1064,-952,-1025,-905,-1249,-1584,-1892,-1574,-779,-671,-289,362,793,791,824,983,826,245,-86,-112,-444,-713,-569,-529,-535,-489,-241,-103,-79,-78,-52,-23,-66,50,138,31,-108,-36,-217,-469,-327,-140,-237,-258,-174,-172,-154,43,118,5,17,69,72,84,108,30,-75,-138,-195,-265,-309,-321,-298,-312,-289,-210,-123,-74,-59,-50,-99,-115,-96,-87,-121,-154,-169,-150,-103,-54,-23,-18,-12,7,-4,-18,-19,-18,-39,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 160 degrees, measured left/right ears + {-3,-2,-1,-2,-3,-4,2,0,6,-7,13,-18,18,-26,33,-31,62,31,2076,4538,-694,-3863,125,1086,-1108,3465,9851,4533,-442,2386,1455,-2365,-2425,-2708,-4694,-3586,-1558,-2067,-2044,21,992,405,1256,2133,1326,389,372,312,-253,-298,-203,-589,-884,-853,-1098,-948,-139,313,225,93,222,196,-71,-218,-356,-491,-517,-526,-473,-285,-83,-68,-214,-161,103,155,21,-38,-29,-83,-150,-119,-21,-71,-207,-280,-369,-370,-210,-90,-143,-189,-108,-63,-80,-11,54,37,-44,-119,-170,-146,-97,-120,-190,-252,-222,-142,-65,-53,-128,-222,-232,-131,-31,-10,-46,-108,-143,-127,-92,-87,-119,-148,-154,-121,-54,13,0,0,0,0,0,0,0,0,0,0,0,0}, + {14,-19,30,-36,32,-41,34,-40,39,-56,2069,7034,-871,-5114,1662,78,-2586,4577,12065,6021,2867,5913,1004,-3390,-2567,-4944,-6779,-4927,-4609,-4278,-2404,-700,670,1176,2735,2954,1495,1042,713,-136,-892,-843,-839,-829,-1109,-1354,-1942,-1762,-965,-612,-154,318,602,746,917,1035,808,239,-21,-101,-406,-607,-461,-417,-463,-431,-271,-196,-155,-173,-227,-215,-158,-20,147,110,2,8,-164,-361,-292,-159,-193,-153,-145,-239,-276,-83,69,66,90,68,36,52,56,0,-72,-127,-174,-225,-238,-256,-288,-361,-360,-273,-160,-66,-21,-41,-108,-118,-91,-70,-66,-100,-145,-138,-94,-34,-1,-5,-44,-51,-45,-45,-19,-23,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 165 degrees, measured left/right ears + {-3,1,-2,-2,-3,2,-3,6,-8,13,-21,16,-26,29,-31,59,20,2032,4908,-346,-4252,-263,1214,-1103,3449,10731,5022,-762,2602,1787,-2635,-2836,-2829,-4931,-4038,-1695,-2086,-2344,-54,1240,408,1222,2282,1424,470,408,271,-359,-410,-247,-529,-936,-1204,-1254,-930,-420,6,275,407,474,410,215,74,28,-218,-637,-714,-554,-427,-335,-329,-333,-242,-26,95,96,49,77,38,-92,-21,78,-26,-204,-258,-349,-421,-286,-178,-260,-266,-127,-70,-51,42,84,27,-46,-103,-129,-96,-23,-19,-127,-221,-240,-202,-152,-134,-165,-270,-303,-196,-47,13,-13,-59,-104,-93,-68,-73,-108,-144,-164,-145,-78,-3,21,0,0,0,0,0,0,0,0,0,0,0,0}, + {-4,13,-19,29,-38,35,-52,54,-65,74,-81,2340,6389,-772,-4101,326,-368,-1382,4633,11636,6713,2408,4127,1228,-2521,-3486,-5084,-5900,-5111,-4471,-3390,-2254,-882,1068,1431,2227,2514,1790,1059,339,-86,-756,-847,-603,-666,-1186,-1434,-1700,-1669,-1231,-605,52,214,383,750,977,1027,723,297,56,-114,-322,-415,-333,-317,-461,-587,-409,-289,-278,-329,-258,-211,-214,-33,208,206,86,34,-175,-282,-156,-109,-239,-292,-235,-228,-244,-85,55,94,65,-16,-61,-18,69,75,-3,-93,-150,-196,-229,-267,-316,-389,-395,-309,-159,-62,-32,-50,-99,-103,-64,-21,-36,-96,-134,-127,-75,-11,4,-33,-88,-93,-77,-53,-32,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 170 degrees, measured left/right ears + {0,0,-3,-4,3,-4,6,-7,15,-22,17,-27,29,-34,55,16,2040,5198,-74,-4511,-618,1244,-1042,3455,11471,5594,-986,2739,2102,-2853,-3279,-2952,-5120,-4545,-1892,-2034,-2546,-207,1406,519,1203,2421,1590,452,376,311,-359,-510,-271,-726,-1295,-1055,-1107,-1130,-624,-136,145,256,490,494,415,613,535,-51,-485,-523,-554,-639,-569,-453,-523,-517,-194,30,48,39,56,73,72,129,179,58,-121,-240,-370,-442,-306,-176,-285,-363,-232,-103,-62,46,90,-6,-69,-68,-49,-26,23,32,-46,-143,-226,-267,-242,-192,-214,-318,-348,-229,-68,-7,-18,-42,-64,-58,-30,-35,-92,-137,-146,-139,-105,-36,-3,-39,0,0,0,0,0,0,0,0,0,0,0,0}, + {3,-5,11,-12,25,-34,33,-47,53,-67,82,-70,2399,5921,-320,-3942,-720,9,-754,4209,11699,7209,1325,3101,1895,-2433,-4150,-4608,-5429,-5330,-4030,-2675,-2383,-853,1413,1386,1795,2264,1839,1128,446,-293,-660,-684,-591,-560,-1227,-1541,-1602,-1376,-1105,-719,-68,269,405,672,849,870,752,404,145,-16,-225,-317,-297,-356,-567,-741,-574,-369,-360,-401,-274,-127,-63,77,242,229,117,42,-135,-303,-219,-116,-173,-300,-316,-257,-210,-50,37,14,-73,-77,-21,34,107,121,68,-59,-162,-229,-266,-268,-303,-384,-431,-337,-159,-46,-30,-67,-82,-64,-24,-2,-31,-83,-112,-103,-73,-26,-11,-59,-120,-117,-88,-61,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 175 degrees, measured left/right ears + {0,-3,-4,4,-3,5,-7,16,-23,19,-26,29,-37,54,10,2094,5398,131,-4603,-926,1186,-947,3482,11948,6225,-962,2781,2348,-2957,-3704,-3188,-5175,-4991,-2281,-2001,-2617,-343,1502,664,1162,2480,1847,499,262,319,-309,-526,-559,-857,-1127,-1226,-1316,-1106,-597,-247,24,100,186,430,796,927,590,250,-36,-242,-505,-662,-558,-596,-772,-749,-391,-102,-25,-42,8,75,89,190,305,190,-35,-175,-350,-430,-290,-162,-280,-361,-261,-188,-159,-32,64,-6,-64,-36,-4,32,85,96,6,-128,-217,-265,-263,-241,-276,-364,-385,-256,-91,-15,-23,-50,-55,-43,-4,2,-46,-109,-152,-138,-102,-52,-27,-60,-101,0,0,0,0,0,0,0,0,0,0,0,0}, + {-5,2,-2,9,-10,19,-28,25,-40,44,-57,73,-38,2329,5661,40,-4201,-1159,574,-643,3807,11970,7200,191,2772,2360,-2718,-4296,-4006,-5257,-5407,-3396,-2263,-2564,-638,1577,1100,1504,2279,1820,965,495,41,-753,-784,-388,-636,-1254,-1471,-1557,-1319,-799,-491,-247,91,525,622,559,800,846,553,193,27,-182,-422,-384,-435,-704,-861,-651,-440,-353,-277,-167,-72,35,256,364,201,25,-56,-207,-329,-217,-88,-153,-278,-316,-318,-280,-97,22,6,-59,-59,-17,48,140,162,78,-71,-195,-264,-265,-258,-318,-411,-426,-312,-144,-49,-31,-61,-77,-52,-9,22,-6,-70,-121,-126,-89,-46,-31,-76,-127,-117,-88,0,0,0,0,0,0,0,0,0,0,0,0} + }, + { // 180 degrees, measured left/right ears + {-3,-4,3,-4,6,-9,16,-25,19,-31,34,-46,60,-8,2200,5530,192,-4501,-1159,994,-791,3572,12125,6811,-604,2758,2477,-2946,-4064,-3530,-5220,-5273,-2800,-2070,-2631,-454,1570,847,1284,2371,1898,744,291,266,-401,-869,-519,-607,-1259,-1358,-1433,-1302,-662,-168,-84,-173,223,718,668,709,834,593,149,-154,-298,-432,-521,-623,-815,-876,-560,-307,-258,-149,9,40,62,235,376,223,-47,-141,-249,-333,-247,-136,-208,-341,-301,-266,-265,-124,53,48,-53,-68,-32,61,155,167,37,-124,-209,-254,-266,-276,-308,-389,-407,-289,-120,-33,-35,-51,-66,-41,3,26,-14,-87,-134,-143,-108,-50,-25,-76,-124,-110,0,0,0,0,0,0,0,0,0,0,0,0}, + {-3,-4,3,-4,6,-9,16,-25,19,-31,34,-46,60,-8,2200,5530,192,-4501,-1159,994,-791,3572,12125,6811,-604,2758,2477,-2946,-4064,-3530,-5220,-5273,-2800,-2070,-2631,-454,1570,847,1284,2371,1898,744,291,266,-401,-869,-519,-607,-1259,-1358,-1433,-1302,-662,-168,-84,-173,223,718,668,709,834,593,149,-154,-298,-432,-521,-623,-815,-876,-560,-307,-258,-149,9,40,62,235,376,223,-47,-141,-249,-333,-247,-136,-208,-341,-301,-266,-265,-124,53,48,-53,-68,-32,61,155,167,37,-124,-209,-254,-266,-276,-308,-389,-407,-289,-120,-33,-35,-51,-66,-41,3,26,-14,-87,-134,-143,-108,-50,-25,-76,-124,-110,0,0,0,0,0,0,0,0,0,0,0,0} + } +}; +inline constexpr std::int16_t normal48000[directions][2][taps] = { + { // 0 degrees, measured left/right ears + {10,-12,26,-27,31,-24,3,29,-82,133,-169,189,51,4864,7267,-4810,-3900,2957,-5107,64,9185,3622,3640,12917,10387,-6104,-6581,4354,-3565,-14484,-7288,562,-4544,-6604,661,2727,-56,1062,4056,3725,1523,2025,2394,112,-1047,545,1001,-983,-1665,-1087,-1199,-1990,-2674,-2550,-2190,-1752,-822,-13,115,259,766,1327,1390,975,725,606,333,-121,-258,-259,-621,-820,-680,-749,-923,-762,-554,-586,-548,-218,32,99,211,413,557,389,110,-32,-11,-57,-264,-301,-269,-363,-379,-245,-158,-178,-143,-9,-37,-224,-198,6,78,29,22,30,-69,-147,-118,-151,-196,-179,-202,-243,-192,-45,61,62,-8,-45,-33,-96,-197,-195,-156,-183,-186,-119,-63,-44,-21,-26,-56,-57,-39,-51,-66,-14}, + {10,-12,26,-27,31,-24,3,29,-82,133,-169,189,51,4864,7267,-4810,-3900,2957,-5107,64,9185,3622,3640,12917,10387,-6104,-6581,4354,-3565,-14484,-7288,562,-4544,-6604,661,2727,-56,1062,4056,3725,1523,2025,2394,112,-1047,545,1001,-983,-1665,-1087,-1199,-1990,-2674,-2550,-2190,-1752,-822,-13,115,259,766,1327,1390,975,725,606,333,-121,-258,-259,-621,-820,-680,-749,-923,-762,-554,-586,-548,-218,32,99,211,413,557,389,110,-32,-11,-57,-264,-301,-269,-363,-379,-245,-158,-178,-143,-9,-37,-224,-198,6,78,29,22,30,-69,-147,-118,-151,-196,-179,-202,-243,-192,-45,61,62,-8,-45,-33,-96,-197,-195,-156,-183,-186,-119,-63,-44,-21,-26,-56,-57,-39,-51,-66,-14} + }, + { // 5 degrees, measured left/right ears + {-5,8,-6,17,-22,26,-18,-6,30,-70,106,-134,152,63,4065,6620,-3503,-3645,2621,-4135,-759,7762,3922,3206,10919,10224,-3628,-6078,2961,-2317,-12198,-7492,-176,-3559,-5979,-257,2274,238,679,3094,3319,1531,1609,2274,715,-734,312,1198,-324,-1544,-1223,-1104,-2022,-2710,-2241,-1707,-1527,-901,13,376,371,420,765,1066,826,484,365,248,-71,-235,-273,-558,-766,-652,-634,-830,-742,-474,-417,-407,-169,98,181,229,326,382,273,58,-114,-112,-135,-277,-253,-181,-254,-305,-194,-113,-178,-164,-49,-68,-200,-180,-10,44,-24,-25,-21,-103,-152,-121,-117,-143,-149,-171,-198,-146,-44,37,72,25,-23,-41,-106,-191,-201,-169,-194,-200,-142,-94,-82,-71,-48,-52,-54,-45,-33,-7}, + {-13,31,-30,32,-18,-18,58,-120,169,-204,218,-60,4710,8706,-4682,-5472,3401,-5272,-505,10310,3955,3388,13960,11842,-6951,-8297,5056,-2862,-15865,-8401,974,-4435,-7555,483,3275,-191,756,4486,4429,1704,2182,2824,134,-1418,300,953,-1037,-1701,-1059,-1156,-1965,-2652,-2748,-2677,-2152,-1099,-343,-192,430,1276,1622,1599,1189,921,785,485,4,-242,-268,-613,-841,-699,-774,-1001,-843,-642,-674,-650,-331,-46,6,166,411,582,490,230,68,53,-3,-237,-272,-197,-375,-507,-343,-196,-230,-190,-29,-32,-227,-201,65,138,54,50,65,-29,-115,-83,-151,-237,-210,-242,-291,-247,-103,31,52,-6,-51,-46,-78,-174,-173,-127,-184,-182,-115,-66,-32,-3,22,-28,-54,-36,-54,-78,-64,-12} + }, + { // 10 degrees, measured left/right ears + {-2,-1,7,-10,19,-18,17,-9,-5,25,-56,84,-104,124,78,3528,5901,-2639,-3265,2184,-3327,-1052,6567,4041,3018,9425,9680,-2020,-5501,1884,-1483,-10298,-7378,-626,-2877,-5402,-759,1922,352,303,2442,3029,1376,1400,2307,1030,-510,188,1056,-91,-1191,-1133,-1225,-2030,-2449,-1883,-1493,-1403,-818,0,443,513,393,387,543,518,353,243,70,-183,-206,-224,-551,-758,-608,-575,-722,-605,-321,-220,-231,-58,128,180,198,199,230,147,-16,-139,-180,-197,-294,-241,-111,-171,-253,-206,-118,-119,-151,-87,-84,-186,-166,-28,39,-19,-62,-50,-101,-156,-130,-125,-149,-144,-136,-153,-143,-56,47,86,32,-37,-65,-105,-164,-172,-172,-219,-219,-170,-119,-99,-78,-56,-68,-58,-31,-5}, + {31,-29,24,1,-35,84,-157,206,-220,212,-112,4390,10153,-4104,-7332,3537,-5281,-1053,11499,4174,3339,15209,13028,-7722,-9877,5352,-2586,-16725,-8978,921,-4466,-7995,355,3429,-272,596,4552,4967,2072,2404,3205,350,-1855,-469,1207,-483,-1888,-1208,-1104,-2034,-2763,-2886,-3006,-2665,-1673,-648,31,790,1445,1790,1909,1485,1083,830,501,65,-143,-199,-652,-913,-705,-768,-1062,-911,-661,-764,-792,-403,-77,-10,149,383,598,569,333,117,48,6,-192,-224,-185,-367,-487,-384,-288,-330,-287,-81,-46,-198,-155,98,207,134,112,102,-22,-125,-98,-133,-224,-236,-271,-344,-312,-159,-19,29,-30,-75,-49,-70,-138,-130,-101,-162,-184,-119,-69,-45,16,43,-9,-50,-38,-67,-87,-55,-83,-28} + }, + { // 15 degrees, measured left/right ears + {-3,-1,-1,6,-6,12,-12,15,-8,-9,26,-51,63,-79,98,59,2888,5380,-1711,-3137,1893,-2516,-1466,5551,4065,2687,8031,9246,-552,-5053,1152,-534,-8601,-7165,-997,-2286,-4923,-1285,1536,244,-49,1970,2662,1335,1433,2309,1214,-329,127,884,-36,-876,-896,-1199,-1836,-2097,-1811,-1496,-1233,-693,-21,327,382,282,235,284,226,154,73,-37,-172,-238,-232,-433,-683,-601,-484,-529,-392,-173,-119,-138,-52,85,119,94,106,146,88,-68,-194,-187,-199,-280,-231,-135,-152,-215,-157,-88,-135,-148,-101,-96,-172,-167,-20,38,-6,-33,-65,-125,-177,-161,-152,-169,-126,-109,-128,-108,-49,27,47,-1,-52,-77,-89,-124,-159,-177,-225,-231,-166,-130,-112,-93,-66,-58,-66,-16}, + {-5,8,13,-67,122,-184,200,-189,151,-88,3586,11452,-2153,-9666,2895,-4345,-2327,12175,5145,3024,16021,14722,-7552,-11835,4924,-1759,-17406,-9911,1028,-4246,-8615,175,3801,-496,284,4484,5379,2398,2531,3867,409,-2748,-708,1916,-205,-1957,-1030,-1235,-2376,-2841,-2842,-3547,-3639,-2060,-303,475,862,1353,1932,2283,1792,1195,855,528,69,-158,-160,-616,-920,-748,-820,-1112,-903,-624,-830,-886,-459,-83,-10,121,384,648,632,334,104,87,71,-169,-227,-155,-360,-513,-403,-344,-429,-347,-79,-19,-186,-173,125,289,225,177,114,-11,-107,-75,-133,-265,-255,-292,-384,-367,-205,-30,28,-36,-109,-77,-51,-123,-120,-51,-122,-168,-121,-76,-42,4,47,-3,-52,-51,-61,-83,-60,-56,-65,-12} + }, + { // 20 degrees, measured left/right ears + {2,-5,-2,1,4,-7,10,-8,10,-1,-12,30,-46,51,-56,74,34,2241,4908,-811,-3008,1597,-1784,-1734,4561,3937,2413,6708,8757,810,-4488,589,297,-6939,-6860,-1353,-1799,-4534,-1753,1037,75,-224,1495,2373,1518,1414,2135,1364,-107,53,759,102,-657,-691,-967,-1614,-1953,-1770,-1386,-1057,-676,-227,-10,118,273,268,109,-47,-60,-11,-10,-128,-236,-236,-325,-470,-454,-415,-412,-276,-145,-113,-139,-92,33,80,70,63,75,15,-103,-195,-190,-161,-235,-249,-163,-140,-183,-161,-104,-127,-157,-99,-53,-117,-148,-39,45,-5,-64,-69,-125,-192,-179,-159,-145,-117,-98,-99,-102,-64,-22,-3,-20,-58,-54,-60,-116,-147,-157,-179,-191,-178,-129,-121,-103,-73,-82,-20}, + {-22,54,-92,131,-181,165,-107,30,23,2471,12013,1231,-11533,689,-2623,-3358,11528,6350,3350,16219,16058,-5788,-13227,3043,-773,-16816,-11576,-37,-2932,-8651,-1144,4292,8,-191,3873,5622,3177,2461,3681,416,-2703,-668,1987,359,-1695,-1198,-1210,-2417,-3079,-3217,-4252,-4503,-2080,541,669,430,1414,2287,2535,1881,1172,922,644,129,-199,-238,-654,-913,-732,-865,-1192,-945,-606,-773,-902,-485,-40,-41,76,411,683,634,341,121,35,71,-76,-174,-147,-392,-596,-513,-410,-407,-323,-86,-12,-175,-180,107,329,297,220,146,8,-90,-80,-143,-269,-288,-324,-442,-448,-247,-34,60,-8,-106,-92,-89,-126,-117,-58,-103,-156,-97,-62,-55,-8,25,-23,-77,-89,-71,-61,-14,-9,-50,2,9} + }, + { // 25 degrees, measured left/right ears + {-5,2,-1,-2,-1,4,-3,8,-3,5,5,-16,31,-39,38,-32,55,14,1611,4386,115,-2821,1180,-988,-1882,3468,3792,2184,5413,8182,2100,-3732,71,975,-5263,-6449,-1775,-1471,-4083,-2197,412,14,-287,1106,2191,1557,1324,2008,1460,105,52,764,327,-514,-720,-859,-1288,-1716,-1609,-1283,-1173,-931,-526,-211,7,131,142,27,-105,-115,13,111,-55,-201,-124,-164,-334,-367,-374,-449,-360,-158,-95,-156,-105,40,64,5,-6,34,6,-95,-164,-156,-151,-220,-233,-168,-162,-205,-170,-117,-129,-130,-63,-6,-67,-119,-58,-7,-44,-77,-68,-108,-166,-171,-155,-139,-117,-103,-123,-133,-88,-30,-15,-40,-65,-49,-45,-89,-115,-110,-123,-160,-163,-154,-146,-127,-96,-19}, + {62,-108,130,-139,78,16,-110,178,1228,11306,5876,-11619,-3399,-949,-3647,9852,7365,3485,16440,17356,-3323,-13148,510,-545,-15205,-12621,-2586,-2537,-7123,-2318,3544,782,124,3292,5077,3883,2785,2464,227,-1197,-588,1243,1076,-1026,-1443,-1400,-1992,-3135,-4458,-5137,-4254,-1651,440,532,535,1517,2407,2675,1977,1171,892,718,281,-219,-335,-615,-934,-836,-881,-1194,-1031,-653,-701,-795,-447,-9,-25,25,379,701,715,363,58,-29,38,0,-128,-160,-390,-661,-589,-423,-373,-292,-102,-7,-124,-179,60,325,349,275,156,15,-79,-96,-149,-264,-291,-355,-497,-498,-286,-58,72,47,-67,-96,-98,-119,-131,-87,-105,-148,-102,-64,-45,-19,1,-38,-110,-139,-96,-38,31,62,26,12,-18,-9} + }, + { // 30 degrees, measured left/right ears + {0,-3,2,-1,-1,-2,2,-1,3,-1,-1,8,-17,27,-32,22,-9,32,2,1047,3774,988,-2515,682,-221,-1913,2368,3568,2008,4233,7425,3295,-2754,-422,1466,-3636,-5942,-2284,-1217,-3537,-2699,-178,131,-275,654,1876,1655,1303,1804,1541,412,224,739,301,-534,-707,-643,-916,-1413,-1637,-1550,-1366,-1081,-717,-429,-221,-52,37,91,82,43,109,187,75,-55,-52,-140,-356,-437,-405,-464,-441,-242,-95,-99,-105,-39,-8,-27,-9,60,48,-57,-159,-179,-150,-198,-230,-183,-176,-219,-211,-147,-111,-99,-40,9,-41,-103,-82,-46,-68,-91,-79,-95,-139,-151,-156,-159,-139,-127,-142,-148,-96,-51,-39,-50,-61,-45,-36,-48,-71,-76,-106,-142,-170,-167,-154,-143,-31}, + {-76,79,-64,-29,120,-225,299,217,9162,10387,-8661,-8305,-988,-2858,7589,8103,3601,15703,18959,86,-12312,-1846,-342,-13453,-13289,-5148,-3287,-6063,-3043,3049,1279,84,3458,5275,3586,1701,2315,1229,-1001,-636,1382,1275,-698,-1250,-1159,-1899,-3686,-5490,-5416,-3354,-1468,-454,313,1027,1766,2220,2491,2108,1411,967,621,233,-208,-299,-521,-927,-985,-923,-1178,-1154,-721,-607,-609,-426,-105,24,130,425,691,706,346,67,-20,-44,-88,-162,-175,-366,-615,-567,-397,-356,-293,-107,-4,-100,-179,41,325,356,288,190,25,-127,-140,-135,-251,-297,-350,-505,-530,-333,-82,78,87,-12,-86,-112,-131,-134,-69,-86,-169,-148,-96,-50,-26,-3,-36,-120,-165,-141,-43,61,121,84,38,1,-44,-13} + }, + { // 35 degrees, measured left/right ears + {-4,1,-1,0,0,-1,-1,2,1,1,1,-4,13,-18,20,-17,3,16,1,14,601,3036,1741,-2001,103,425,-1708,1286,3193,1951,3199,6445,4317,-1501,-813,1617,-2102,-5234,-2791,-1054,-2975,-3035,-609,124,-384,315,1626,1728,1304,1645,1705,758,190,468,304,-321,-497,-491,-887,-1462,-1728,-1636,-1447,-1302,-1000,-605,-337,-115,100,318,373,254,228,269,193,-4,-129,-226,-430,-512,-465,-484,-444,-299,-146,-106,-147,-73,17,37,29,50,79,-23,-155,-183,-154,-174,-216,-201,-193,-236,-229,-142,-104,-99,-43,27,-5,-102,-100,-55,-73,-99,-91,-96,-126,-145,-134,-137,-158,-157,-167,-143,-101,-80,-55,-39,-43,-31,-7,-21,-52,-78,-81,-123,-147,-155,-176,-43}, + {-4,41,-125,197,-272,329,-262,6094,13116,-2947,-11656,-3511,-1844,5870,7927,3761,14888,19810,3236,-9903,-3235,-994,-11286,-12723,-7986,-5157,-4940,-3800,1415,2126,799,3212,5573,3407,248,2401,2684,-823,-1047,1181,1488,-267,-900,-841,-2147,-4537,-5973,-4815,-2660,-1703,-1097,75,1263,1982,2028,2176,2152,1705,1173,548,56,-255,-222,-464,-891,-978,-1046,-1217,-1212,-795,-499,-489,-430,-213,84,327,529,695,643,333,104,-19,-152,-255,-237,-145,-323,-570,-514,-362,-296,-242,-112,-30,-99,-129,21,265,366,312,205,17,-164,-187,-174,-259,-287,-318,-442,-532,-410,-125,94,156,32,-89,-118,-137,-128,-73,-81,-163,-175,-145,-91,-29,5,-38,-122,-166,-144,-42,50,121,112,62,17,-28,8,10} + }, + { // 40 degrees, measured left/right ears + {1,-1,0,0,-1,1,-1,-2,1,2,-1,3,-3,10,-14,12,-6,-9,26,-16,35,270,2248,2265,-1293,-468,867,-1253,281,2655,1987,2350,5306,5050,-36,-1076,1409,-690,-4286,-3207,-996,-2315,-3243,-1235,53,-268,59,1331,1835,1417,1494,1617,884,226,362,463,-57,-596,-822,-1024,-1336,-1662,-1785,-1671,-1462,-1084,-615,-275,-8,289,523,575,469,313,264,183,-60,-258,-373,-485,-551,-532,-497,-456,-354,-218,-129,-92,-21,62,69,35,52,69,3,-116,-181,-156,-172,-240,-243,-210,-223,-216,-155,-101,-87,-60,-2,-17,-81,-100,-79,-72,-101,-99,-78,-105,-121,-133,-156,-165,-171,-153,-157,-137,-91,-55,-21,-27,-17,-4,-8,-48,-67,-84,-108,-135,-164,-40}, + {88,-179,221,-214,190,-182,2915,13258,4096,-12008,-7498,-1986,4755,7781,3182,13796,21295,5772,-8161,-3310,-684,-10053,-11652,-8740,-8112,-5445,-3467,-175,1256,1268,4482,5479,2024,332,3230,2877,-400,-630,474,1028,216,-275,-694,-2854,-5186,-5613,-4068,-2649,-1956,-1007,84,989,1808,1984,1974,2062,1855,1405,564,-70,-255,-214,-505,-876,-893,-1084,-1336,-1305,-767,-433,-504,-411,-137,180,363,611,775,649,337,50,-95,-259,-321,-226,-180,-340,-520,-464,-302,-266,-233,-60,18,-41,-106,-44,188,323,347,268,13,-213,-265,-224,-270,-298,-264,-371,-515,-439,-170,97,199,87,-50,-123,-151,-121,-82,-89,-178,-210,-177,-131,-42,6,-16,-98,-172,-134,-25,46,96,111,59,19,-29,-8,74,25} + }, + { // 45 degrees, measured left/right ears + {3,1,0,0,-1,-1,2,-1,-1,2,2,-3,7,-2,6,-4,5,10,-15,31,-12,36,89,1488,2436,-424,-883,1013,-612,-512,1960,2025,1773,4132,5341,1463,-1053,985,466,-3066,-3286,-1183,-1957,-3261,-1619,-25,-168,-40,1138,1837,1344,1207,1567,1166,452,267,216,-253,-792,-975,-1033,-1300,-1716,-1881,-1682,-1366,-956,-465,-124,139,448,659,687,523,331,218,48,-193,-383,-442,-506,-596,-568,-525,-475,-349,-192,-69,-45,3,70,71,66,58,52,12,-75,-154,-193,-220,-254,-242,-196,-191,-202,-157,-107,-105,-94,-49,-30,-70,-94,-58,-42,-74,-84,-72,-78,-122,-153,-152,-161,-159,-176,-165,-131,-97,-43,-14,0,-6,-6,-18,-54,-84,-85,-103,-129,-32}, + {-95,79,-11,-98,185,498,10468,10829,-8467,-11824,-3441,3404,7745,2753,10969,23026,9597,-6948,-3791,276,-8199,-10869,-8323,-10004,-7099,-3774,-1518,552,717,4371,5516,1838,878,3380,3454,478,-387,56,537,529,-193,-971,-3278,-5328,-4925,-3762,-2907,-2059,-850,464,911,1215,1696,1949,1981,1767,1531,746,-8,-248,-328,-475,-843,-954,-1032,-1407,-1463,-855,-384,-395,-389,-73,273,412,621,763,703,358,-36,-173,-297,-328,-228,-206,-324,-490,-458,-292,-278,-235,-22,106,49,-63,-78,57,245,365,306,45,-223,-331,-303,-309,-302,-232,-315,-473,-465,-238,66,223,148,2,-108,-163,-133,-81,-80,-180,-252,-249,-196,-76,7,-2,-70,-141,-133,-33,54,99,90,48,-7,-47,-32,39,99,25} + }, + { // 50 degrees, measured left/right ears + {1,1,0,2,0,1,-1,-1,-1,-1,-1,2,-2,2,-1,0,1,-6,15,-15,20,-2,22,17,835,2256,464,-1019,851,78,-979,1138,1993,1459,3042,5129,2781,-609,518,1373,-1695,-3385,-1673,-1495,-2877,-1970,-215,66,-32,738,1542,1390,1275,1620,1279,192,-337,-79,-244,-893,-1193,-1157,-1224,-1557,-1730,-1486,-1111,-709,-301,2,265,500,644,656,474,236,61,-96,-290,-467,-489,-516,-618,-597,-495,-402,-290,-142,-34,-47,-31,68,112,66,26,41,15,-90,-185,-212,-212,-238,-242,-195,-181,-202,-179,-137,-132,-126,-72,-25,-46,-76,-40,-16,-58,-80,-60,-80,-141,-160,-153,-167,-183,-170,-153,-129,-90,-48,-6,-14,-31,-41,-48,-69,-86,-73,-76,-20}, + {-101,200,-281,322,-357,5498,14511,-210,-14789,-7027,2071,7177,3301,6669,22874,15506,-4816,-5151,1151,-5480,-10566,-7493,-9804,-9546,-4566,-2447,-657,239,2997,4525,2132,1721,3639,4244,1470,1,448,99,390,-10,-1590,-3885,-5088,-4149,-3699,-3430,-2108,-507,617,950,1042,1335,1677,1810,1712,1564,951,171,-195,-352,-455,-773,-990,-1101,-1457,-1580,-1067,-373,-250,-312,-33,317,516,588,707,720,372,-13,-147,-265,-398,-336,-177,-196,-429,-519,-370,-269,-202,-43,137,135,8,-43,-16,151,325,338,129,-209,-366,-354,-348,-325,-236,-242,-403,-493,-318,7,210,213,63,-85,-154,-142,-60,-44,-142,-250,-304,-282,-172,-43,27,-9,-87,-129,-72,65,125,124,70,-27,-102,-92,28,109,74,10} + }, + { // 55 degrees, measured left/right ears + {1,1,2,1,1,1,1,-1,-1,0,0,0,0,0,1,0,-2,4,-4,14,-10,10,12,5,10,362,1794,1197,-781,475,636,-1055,302,1802,1365,2177,4481,3762,431,272,1518,-600,-2914,-1978,-1239,-2359,-2093,-428,88,-165,485,1532,1655,1259,1015,636,-70,-479,-304,-489,-1060,-1206,-1022,-964,-1217,-1381,-1182,-819,-449,-187,17,248,438,525,477,320,127,-86,-232,-334,-470,-520,-531,-552,-501,-401,-302,-232,-143,-54,-47,-19,50,72,57,12,-2,-26,-104,-159,-191,-199,-230,-260,-215,-186,-202,-194,-154,-125,-110,-70,-35,-42,-48,-26,-7,-43,-68,-69,-102,-128,-152,-164,-174,-175,-150,-138,-122,-98,-78,-60,-49,-53,-44,-41,-45,-54,-60,-14}, + {76,-38,-30,82,1032,12140,10469,-11886,-13480,-141,6418,4609,2614,18678,22324,155,-7178,975,-1792,-9394,-7839,-8389,-10821,-6067,-3301,-1869,58,714,2659,2812,1876,2897,5097,3803,539,413,675,562,-258,-2107,-3923,-5101,-4213,-3582,-3718,-2378,-434,717,1041,1072,1166,1375,1651,1617,1394,1150,487,-113,-312,-429,-662,-939,-1183,-1586,-1716,-1197,-513,-250,-190,11,316,590,597,576,670,556,125,-188,-221,-384,-454,-230,-131,-317,-522,-440,-273,-236,-94,146,212,87,-41,-64,96,292,336,210,-117,-386,-425,-387,-335,-246,-203,-328,-479,-406,-116,167,252,116,-44,-129,-154,-77,-17,-69,-196,-303,-343,-298,-152,-16,26,-27,-109,-98,36,148,162,120,4,-117,-152,-78,67,120,53,5} + }, + { // 60 degrees, measured left/right ears + {-1,0,0,1,1,1,1,-1,-1,-2,-1,-1,0,-2,0,-2,0,-5,4,2,4,-5,-2,27,-6,6,105,1192,1595,-202,68,881,-787,-375,1434,1371,1627,3734,4370,1459,-8,1432,598,-2094,-2280,-1147,-1710,-2134,-868,82,203,594,1205,1193,553,314,355,-190,-781,-683,-537,-852,-989,-714,-552,-765,-1011,-877,-552,-349,-220,-66,122,257,305,277,147,-31,-185,-272,-353,-466,-474,-413,-404,-394,-312,-235,-214,-161,-79,-41,-36,-23,22,29,-23,-41,-47,-84,-128,-187,-215,-236,-265,-227,-184,-182,-168,-134,-110,-104,-79,-37,-35,-46,-25,-17,-38,-67,-76,-75,-114,-149,-160,-174,-163,-146,-152,-151,-143,-117,-74,-49,-24,-21,-16,-28,-60,-16}, + {167,-255,294,-313,5052,15890,485,-18426,-6923,5731,6162,1220,10251,25710,10208,-8132,-1753,1947,-6130,-8601,-7067,-10683,-8578,-3570,-2838,-827,-594,265,2514,1900,2130,4352,5291,2763,878,1138,970,187,-2152,-4031,-4735,-4680,-3951,-3949,-2963,-727,799,1106,1030,1147,1243,1473,1528,1336,1213,788,100,-244,-279,-557,-970,-1141,-1487,-1827,-1534,-814,-247,-116,36,278,468,605,559,620,685,385,-47,-247,-326,-456,-375,-156,-236,-446,-460,-334,-258,-188,77,257,170,18,-71,-1,213,371,309,28,-323,-489,-450,-349,-252,-179,-236,-415,-487,-305,50,253,190,27,-100,-155,-119,-5,12,-110,-249,-349,-371,-263,-103,-8,-6,-74,-110,-14,145,189,153,76,-59,-148,-134,-19,85,71,18,2} + }, + { // 65 degrees, measured left/right ears + {3,3,3,5,4,4,5,4,4,4,3,6,6,6,4,8,4,7,7,7,16,3,8,15,33,-6,11,27,640,1590,547,-130,751,-293,-701,905,1493,1623,2751,3907,2590,641,1245,1239,-1073,-2168,-1342,-1327,-1785,-783,302,227,-29,195,531,292,-144,-264,-485,-710,-568,-423,-512,-473,-240,-162,-384,-659,-669,-470,-346,-350,-255,-63,48,79,54,-3,-91,-217,-290,-287,-297,-307,-290,-281,-275,-233,-185,-194,-180,-105,-63,-79,-74,-28,-8,-20,-39,-52,-69,-113,-173,-212,-226,-217,-187,-146,-126,-129,-118,-103,-83,-67,-54,-33,-35,-29,-9,-16,-31,-44,-58,-88,-135,-156,-168,-180,-174,-166,-155,-138,-97,-52,-18,0,4,-13,-38,-11}, + {121,-254,332,53,10348,14594,-10737,-18249,1077,8161,2911,2521,20125,22169,-2493,-7256,2949,-443,-7774,-7279,-8520,-10683,-5695,-2757,-1799,-1337,-2181,1186,2492,1090,2701,5309,4862,1807,1500,2127,1041,-1402,-3943,-4275,-4513,-4627,-4353,-3751,-1658,347,1288,1173,920,1097,1404,1551,1310,1234,1100,434,-174,-202,-264,-844,-1291,-1337,-1559,-1777,-1354,-546,-60,26,158,375,503,505,635,818,611,138,-147,-177,-389,-533,-275,-139,-330,-518,-424,-261,-239,-81,200,260,96,-39,-42,87,287,372,229,-145,-451,-484,-420,-298,-180,-149,-281,-490,-465,-177,152,253,120,-42,-155,-158,-30,48,-7,-158,-321,-375,-330,-192,-61,-18,-49,-124,-80,91,187,166,126,50,-74,-155,-76,47,53,17,-14,-7} + }, + { // 70 degrees, measured left/right ears + {0,0,0,0,1,1,3,1,2,2,0,-1,1,0,-1,2,3,-2,5,0,-2,16,-6,9,12,12,1,-8,19,249,1237,1156,13,376,129,-547,667,1367,1095,1895,3599,3571,1552,1005,1406,-85,-1843,-1463,-604,-911,-1004,-601,-583,-650,-371,-35,-294,-760,-627,-294,-302,-365,-164,24,65,132,93,-181,-476,-581,-532,-514,-566,-467,-299,-225,-149,-108,-103,-143,-203,-177,-128,-140,-199,-211,-180,-192,-208,-205,-221,-211,-184,-161,-136,-130,-82,-41,-54,-66,-79,-80,-108,-175,-198,-178,-162,-143,-134,-128,-125,-127,-102,-109,-113,-83,-58,-25,-19,-20,-17,-33,-37,-65,-121,-156,-193,-200,-197,-191,-169,-159,-116,-83,-65,-36,-15,-16,-43,-14}, + {-31,-52,84,1523,14875,9206,-19012,-13584,7227,7454,129,8146,25695,12509,-9306,-2683,4799,-2709,-7982,-7130,-9719,-9143,-3719,-2138,-1747,-3240,-2301,2466,2068,818,3468,5639,3711,1556,2330,2174,414,-2585,-4298,-4025,-4434,-4683,-4561,-3105,-687,826,1331,1005,811,1108,1538,1516,1235,1251,867,119,-177,-146,-466,-1122,-1362,-1403,-1677,-1657,-1064,-326,-69,-22,203,446,509,474,743,912,496,-27,-126,-184,-486,-477,-170,-178,-472,-563,-398,-270,-205,52,289,202,20,-41,14,150,302,317,85,-292,-485,-441,-346,-234,-156,-184,-377,-548,-418,-39,225,187,22,-113,-176,-130,13,54,-55,-217,-360,-388,-292,-136,-28,-24,-102,-147,-57,119,171,142,116,0,-107,-122,-2,74,32,-32,-99,-29} + }, + { // 75 degrees, measured left/right ears + {0,0,-1,-1,0,0,0,1,1,2,1,0,0,0,0,0,0,0,-2,3,-1,-3,18,-1,-5,19,13,2,-14,20,56,778,1450,471,71,645,53,-176,720,1316,1686,2943,3959,2583,989,1208,892,-598,-1052,-595,-1092,-1917,-1629,-1020,-1001,-1085,-861,-719,-763,-465,24,153,107,223,430,507,389,151,-152,-407,-594,-710,-732,-754,-704,-552,-406,-280,-201,-134,-73,-41,-15,-5,-29,-92,-132,-125,-150,-212,-243,-265,-284,-264,-212,-170,-156,-132,-91,-71,-81,-87,-87,-90,-97,-120,-127,-120,-134,-133,-120,-127,-138,-147,-142,-114,-74,-36,-23,-24,-26,-27,-38,-72,-103,-128,-165,-189,-202,-196,-173,-159,-123,-116,-110,-83,-54,-27,-40,-13}, + {-201,224,-279,3695,17485,2419,-23237,-7758,10789,5404,-675,14663,25947,2602,-10927,1931,5245,-4303,-8080,-7204,-10060,-7604,-2189,-1790,-3153,-4858,-1149,3239,1246,1188,4444,5193,2577,1695,2817,1593,-697,-2907,-3498,-3533,-4695,-4906,-4044,-2328,-442,867,1222,724,637,1210,1648,1393,1223,1320,693,-134,-161,-27,-606,-1296,-1351,-1427,-1721,-1533,-802,-195,-145,-160,178,548,495,501,834,900,425,-67,-81,-255,-535,-329,-71,-264,-603,-578,-351,-275,-167,177,309,136,-29,-27,68,172,326,267,-52,-391,-477,-350,-234,-166,-157,-256,-478,-545,-308,79,236,93,-57,-162,-183,-83,40,43,-88,-265,-379,-367,-231,-75,14,-7,-152,-196,-33,153,176,125,78,-34,-117,-61,86,82,-12,-84,-138,-37} + }, + { // 80 degrees, measured left/right ears + {0,-1,-1,-1,-1,-1,0,-1,0,1,0,0,-1,0,2,0,0,0,-1,0,1,0,2,12,0,-3,28,16,-10,-17,1,12,454,1414,1271,329,200,29,-55,678,1224,1455,2408,3761,3340,1725,1671,1855,163,-1528,-1636,-1621,-2215,-2272,-1778,-1567,-1505,-1181,-712,-412,-109,391,667,575,547,697,719,450,64,-230,-467,-713,-897,-964,-945,-865,-693,-502,-352,-165,-12,66,111,92,78,46,-30,-70,-112,-169,-262,-328,-299,-304,-296,-252,-226,-191,-164,-117,-87,-95,-68,-25,-7,-35,-88,-104,-107,-124,-138,-148,-157,-168,-159,-124,-100,-77,-51,-32,-31,-53,-63,-69,-90,-106,-134,-164,-184,-185,-162,-158,-159,-144,-129,-124,-108,-74,-41,-7}, + {-313,427,-549,5703,18346,-3205,-24555,-3065,12396,3551,-8,19449,23330,-4674,-10113,5669,5356,-5669,-7994,-6878,-10150,-6513,-926,-1963,-5185,-5720,491,3486,119,1830,5551,4517,1627,1927,2836,523,-1568,-2476,-2520,-3274,-4723,-4558,-3678,-1984,-107,723,681,472,684,1202,1496,1318,1368,1281,446,-223,-35,29,-681,-1245,-1338,-1507,-1692,-1392,-641,-183,-241,-238,135,521,481,541,899,885,331,-56,-55,-311,-505,-222,-23,-346,-683,-563,-320,-251,-117,215,273,69,-60,-16,71,195,339,211,-131,-455,-447,-276,-174,-106,-151,-314,-550,-544,-211,150,203,22,-131,-222,-199,-54,70,14,-137,-297,-380,-312,-169,-33,20,-49,-192,-194,0,170,150,94,45,-69,-114,-35,108,67,-39,-98,-173,-49} + }, + { // 85 degrees, measured left/right ears + {1,0,-1,-1,-1,0,0,0,0,1,2,2,1,1,1,0,1,-1,-2,0,0,5,1,-3,15,9,5,23,10,-19,-32,29,79,567,1634,1254,-154,205,817,298,352,955,1282,1888,3569,4640,3268,1615,1081,-152,-1947,-2260,-1942,-2614,-3006,-2342,-1668,-1406,-1105,-508,35,375,728,1008,953,751,738,681,361,-76,-443,-633,-825,-1061,-1113,-1034,-934,-754,-493,-222,-26,93,171,191,159,107,82,29,-92,-178,-229,-286,-320,-323,-316,-322,-310,-260,-209,-175,-123,-55,-21,-7,25,31,-16,-62,-95,-119,-131,-149,-162,-170,-163,-139,-119,-108,-101,-79,-42,-40,-64,-74,-87,-99,-110,-121,-139,-165,-156,-145,-162,-167,-162,-154,-132,-86,-34,-4}, + {-364,528,-672,6734,18447,-6239,-24773,-392,13048,2580,861,21690,20597,-8987,-9077,8636,5805,-6892,-7729,-6086,-10294,-5993,78,-2484,-7212,-5841,1924,3018,-523,2575,5797,4224,1441,1803,2407,-447,-1936,-1862,-1868,-3153,-4455,-3795,-3330,-1992,-19,705,314,8,651,1260,1240,1180,1470,1246,267,-257,147,130,-702,-1157,-1223,-1515,-1750,-1284,-483,-219,-342,-268,97,440,454,574,917,855,296,-54,-56,-300,-457,-166,-3,-385,-692,-516,-276,-227,-91,242,216,-20,-83,-20,83,213,325,173,-169,-442,-414,-259,-128,-42,-115,-335,-594,-529,-158,184,188,-34,-184,-263,-210,-40,71,1,-156,-302,-340,-272,-148,-7,19,-69,-191,-162,15,160,161,93,16,-109,-138,-29,107,69,-31,-111,-193,-53} + }, + { // 90 degrees, measured left/right ears + {0,-1,-1,-1,-1,-1,-1,0,0,-1,1,0,-1,1,0,-1,0,-2,-3,-2,-1,4,-1,-2,5,17,10,-1,15,-6,-22,15,332,735,433,440,1109,809,485,894,762,404,455,868,2178,4418,5250,3093,558,-100,-394,-1689,-2680,-2748,-2962,-3011,-2300,-1543,-1133,-763,-160,425,717,971,1181,1105,797,565,497,175,-344,-652,-792,-902,-1078,-1178,-1062,-883,-614,-318,-125,46,157,209,215,161,117,37,-41,-105,-200,-238,-286,-344,-342,-342,-345,-351,-294,-180,-107,-55,-21,3,32,44,22,-37,-79,-90,-104,-130,-164,-192,-175,-147,-157,-161,-139,-101,-67,-52,-52,-73,-98,-94,-100,-112,-120,-132,-132,-145,-158,-176,-195,-171,-115,-62,-32,-6}, + {-371,536,-699,6457,18519,-6301,-25112,64,13460,2553,1173,21732,19204,-10847,-8960,10799,7037,-7628,-7732,-5030,-10254,-6135,806,-3061,-8824,-5745,2482,2689,-666,2814,5790,3917,1586,2017,1740,-1311,-1931,-1345,-1620,-3007,-3993,-3239,-2915,-1758,-170,479,217,-236,369,1108,1132,1031,1349,1187,286,-222,147,241,-547,-1069,-1151,-1420,-1723,-1326,-424,-158,-374,-342,15,388,399,546,889,803,287,-37,-42,-283,-440,-149,35,-355,-674,-468,-228,-218,-103,242,177,-114,-140,-10,88,192,316,166,-184,-446,-374,-201,-77,-17,-123,-332,-596,-529,-148,182,171,-75,-216,-291,-241,-53,74,20,-144,-305,-356,-286,-129,26,37,-69,-201,-174,26,184,167,72,-31,-148,-161,-43,96,58,-45,-118,-168,-44} + }, + { // 95 degrees, measured left/right ears + {-1,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,1,0,0,1,0,-3,-2,-2,-1,2,-4,2,6,11,9,13,-5,-6,2,226,777,551,-221,-25,843,1293,1065,805,1258,1692,327,-745,1235,3469,4120,3726,1991,26,-622,-561,-1590,-3032,-3204,-2725,-2435,-2095,-1360,-618,-324,17,576,953,1121,1131,977,649,378,205,-148,-545,-801,-825,-851,-1066,-1111,-915,-645,-434,-272,-68,81,167,195,143,85,49,24,-24,-121,-212,-278,-308,-318,-369,-396,-367,-290,-187,-118,-68,-32,-4,18,13,-1,-33,-52,-36,-60,-127,-168,-185,-197,-202,-187,-162,-152,-134,-101,-85,-75,-61,-70,-95,-120,-128,-114,-106,-118,-142,-159,-165,-163,-150,-103,-51,-32,-7}, + {-337,431,-559,4939,18393,-3304,-25514,-1853,13811,3343,747,20000,19405,-10383,-10129,11753,9342,-7410,-8325,-4031,-9694,-6855,1073,-3232,-9830,-6066,2108,2864,-362,2377,5593,3970,1658,2083,1717,-1842,-2228,-874,-1423,-2864,-3670,-2849,-2524,-1573,-87,326,-87,-362,376,859,805,933,1275,1071,287,-133,135,275,-413,-922,-1013,-1352,-1659,-1313,-460,-129,-327,-390,-85,335,361,496,808,728,288,-18,-22,-247,-437,-165,79,-267,-609,-451,-202,-177,-132,190,159,-128,-203,-78,75,166,300,177,-164,-409,-337,-162,-52,6,-114,-334,-577,-509,-160,144,153,-77,-246,-330,-247,-47,93,35,-169,-335,-368,-278,-111,52,57,-76,-203,-153,42,179,145,41,-45,-147,-180,-82,49,34,-31,-92,-145,-38} + }, + { // 100 degrees, measured left/right ears + {1,0,-1,-1,0,0,0,0,0,0,0,0,1,2,1,3,2,1,1,-1,3,-1,0,5,10,5,13,13,9,-13,158,805,783,-177,-274,397,581,542,1028,1764,2145,2200,1001,-941,-294,2182,2902,2306,2005,1434,57,-798,-815,-1640,-2806,-2856,-2272,-1943,-1596,-890,-402,-227,156,728,1017,958,861,750,480,114,-157,-409,-627,-697,-746,-819,-886,-844,-671,-516,-367,-202,-53,54,62,49,82,95,80,21,-76,-172,-231,-245,-295,-375,-382,-296,-220,-200,-156,-83,-36,-30,-42,-36,-18,-15,-23,-31,-47,-85,-146,-201,-217,-202,-174,-151,-152,-165,-148,-100,-69,-65,-75,-85,-108,-124,-117,-115,-122,-122,-105,-107,-110,-97,-82,-56,-35,-7}, + {-206,177,-189,2599,17206,2516,-24823,-6513,13735,5166,-247,16671,20694,-7413,-12302,10747,12628,-5589,-9500,-3547,-8445,-7893,676,-2727,-10233,-6978,1034,3182,325,1646,5133,4154,1934,2063,1740,-1684,-2492,-889,-1207,-2453,-3518,-2867,-2084,-1406,-143,365,-85,-556,157,838,706,658,1053,1098,368,-179,47,331,-275,-827,-873,-1205,-1574,-1314,-461,-101,-313,-374,-121,250,287,428,737,691,276,-40,-2,-163,-409,-224,110,-148,-543,-435,-199,-148,-154,145,174,-125,-216,-131,12,117,279,232,-85,-358,-326,-154,-29,41,-87,-310,-561,-524,-179,124,160,-85,-263,-310,-238,-43,90,22,-179,-339,-343,-251,-132,23,72,-23,-143,-143,2,130,137,73,-33,-157,-208,-118,41,47,-17,-74,-120,-30} + }, + { // 105 degrees, measured left/right ears + {1,0,2,2,0,1,2,-1,1,0,0,0,0,0,2,2,1,1,1,1,0,0,0,14,-2,8,17,8,10,95,786,1022,-55,-440,293,546,304,322,916,2349,3340,2189,543,2,-183,171,980,1226,1119,1207,1106,267,-722,-1045,-1302,-2028,-2351,-1777,-1266,-1158,-881,-464,-13,339,544,707,718,634,448,154,-143,-356,-425,-475,-566,-628,-633,-625,-619,-568,-426,-296,-248,-183,-85,11,52,80,91,16,-65,-117,-153,-213,-278,-270,-249,-245,-217,-176,-133,-111,-110,-92,-82,-67,-23,-15,-50,-67,-58,-75,-135,-172,-174,-170,-159,-165,-182,-182,-156,-110,-82,-86,-94,-86,-87,-113,-138,-135,-111,-76,-47,-47,-48,-62,-61,-56,-61,-14}, + {28,-207,345,334,13797,9833,-20690,-13571,11733,8332,-1055,11494,21891,-1529,-14322,6987,15909,-1354,-10645,-4222,-6427,-8825,-704,-1557,-9833,-8431,-621,3171,1210,971,4364,4450,2255,2050,2035,-1234,-2833,-938,-974,-2127,-3172,-3068,-2037,-1276,-188,330,-8,-477,-83,600,751,682,776,920,536,-80,-179,228,-97,-734,-828,-1062,-1377,-1287,-571,-53,-216,-382,-188,190,246,311,621,697,317,-85,-38,-73,-332,-289,73,-12,-470,-467,-226,-135,-149,78,197,-88,-247,-165,-35,48,238,279,8,-289,-341,-162,-30,50,-54,-286,-504,-547,-261,74,165,-34,-247,-290,-234,-124,25,49,-105,-279,-369,-307,-172,-7,111,37,-126,-185,-63,122,159,68,-53,-165,-197,-121,23,57,-5,-67,-93,-21} + }, + { // 110 degrees, measured left/right ears + {0,0,1,1,0,2,0,0,0,0,0,-1,1,0,0,2,3,0,3,2,2,-6,9,8,-2,11,11,20,50,749,1276,124,-649,183,642,258,91,719,2106,2972,2341,1508,1011,353,-21,-514,-927,-243,501,643,877,963,444,-363,-776,-895,-1211,-1493,-1445,-1187,-1037,-793,-327,-49,89,273,446,456,249,66,-10,-130,-269,-318,-317,-368,-464,-479,-460,-464,-485,-505,-407,-295,-204,-74,-19,-7,4,-8,-35,-103,-134,-108,-118,-159,-191,-187,-167,-153,-131,-155,-178,-146,-103,-59,-73,-88,-80,-112,-118,-96,-82,-94,-116,-132,-166,-203,-199,-168,-144,-133,-118,-99,-100,-97,-113,-132,-123,-99,-69,-55,-23,-10,-2,-20,-47,-67,-103,-28}, + {246,-465,610,-674,8136,15246,-11239,-20243,5546,12026,186,4827,20716,6947,-13957,510,17119,5294,-10066,-6575,-4308,-8653,-3246,-525,-8088,-9908,-2996,2594,2093,565,3286,4685,2778,1957,2328,-91,-3108,-1646,-450,-1563,-2949,-3262,-2119,-1321,-381,300,85,-376,-190,461,683,689,772,821,530,47,-250,10,-53,-646,-809,-910,-1173,-1225,-698,-74,-63,-304,-303,65,274,236,464,670,433,-51,-138,-11,-212,-320,-33,70,-347,-528,-291,-122,-124,0,191,-10,-242,-202,-34,50,157,276,106,-183,-322,-197,-49,22,-29,-220,-426,-546,-361,-20,175,56,-176,-298,-311,-182,21,123,-13,-250,-400,-363,-182,0,82,17,-117,-168,-68,92,130,37,-39,-99,-152,-135,-5,76,31,-35,-76,-18} + }, + { // 115 degrees, measured left/right ears + {1,1,1,2,2,1,3,1,0,1,0,2,1,0,0,4,0,3,1,7,0,-1,9,2,11,4,31,20,683,1530,396,-861,-11,731,289,-29,617,2276,3275,2249,1012,882,966,587,-367,-1160,-1287,-1133,-590,206,572,772,1104,830,-19,-292,-149,-639,-1351,-1452,-1041,-766,-782,-582,-265,-94,5,65,45,2,76,116,1,-125,-148,-154,-253,-343,-367,-424,-507,-533,-479,-354,-274,-227,-160,-114,-88,-91,-81,-35,11,25,-16,-95,-139,-110,-95,-136,-171,-172,-170,-164,-144,-119,-126,-160,-175,-152,-108,-82,-64,-45,-60,-117,-177,-203,-182,-159,-146,-127,-129,-124,-123,-130,-136,-122,-81,-52,-35,-35,-16,8,25,-6,-46,-89,-134,-34}, + {216,-276,223,-183,2390,14944,1893,-21081,-5204,12856,4874,-751,14598,15460,-8411,-6883,14049,12486,-5740,-9651,-3794,-6644,-5972,-1087,-5184,-10100,-6102,971,2851,632,1875,4541,3569,2007,2234,1328,-2303,-2844,-684,-634,-2310,-3519,-2481,-1315,-686,17,155,-163,-298,288,752,700,661,857,722,105,-321,-155,-63,-603,-892,-798,-927,-1134,-867,-175,64,-178,-312,-108,238,240,309,596,541,81,-200,-26,-82,-310,-180,47,-218,-556,-388,-148,-114,-89,131,100,-169,-210,-55,76,110,210,179,-56,-272,-250,-107,-20,-23,-165,-333,-513,-452,-128,141,112,-169,-308,-280,-170,11,104,12,-196,-341,-330,-237,-112,-10,8,-52,-128,-117,-6,83,64,17,-42,-113,-139,-37,90,80,1,-67,-20} + }, + { // 120 degrees, measured left/right ears + {0,2,0,3,2,1,1,-1,0,0,1,1,2,-2,2,1,3,0,6,3,0,8,-5,18,-5,39,12,596,1749,746,-1028,-306,797,379,-192,566,2656,3673,2275,959,859,539,126,-140,-845,-1396,-1261,-1096,-1046,-569,249,871,1063,1104,1142,775,115,-277,-664,-1119,-1165,-975,-927,-926,-740,-518,-422,-377,-226,45,181,218,222,141,50,-20,-104,-267,-380,-392,-404,-426,-465,-456,-389,-326,-280,-278,-260,-127,23,72,65,52,29,-10,-52,-72,-74,-94,-137,-171,-182,-186,-188,-196,-231,-241,-204,-141,-93,-85,-52,-35,-72,-119,-155,-166,-158,-145,-135,-123,-129,-153,-169,-146,-117,-82,-51,-47,-33,-12,14,5,-3,-33,-67,-102,-145,-37}, + {-56,183,-349,475,-427,8731,12098,-12126,-15790,6787,10753,-852,4444,18195,3131,-10739,5921,16653,2632,-10445,-6240,-3873,-6806,-3641,-3070,-8000,-8506,-2302,2780,1525,533,3466,4383,2633,1814,2057,-322,-3111,-1877,-430,-1258,-3033,-3075,-1674,-900,-287,-51,-41,-154,47,660,843,667,720,907,440,-276,-418,-142,-388,-950,-912,-781,-933,-961,-449,78,-19,-230,-185,124,257,181,434,615,306,-135,-107,13,-237,-324,-99,-115,-486,-524,-242,-126,-147,9,165,-18,-166,-85,71,113,161,204,49,-184,-298,-185,-77,-44,-114,-268,-422,-483,-273,-25,52,-68,-198,-198,-178,-95,28,56,-56,-237,-358,-336,-216,-72,11,-41,-149,-186,-68,86,98,41,-9,-62,-103,-55,72,108,25,-44,-16} + }, + { // 125 degrees, measured left/right ears + {2,1,2,1,1,1,-1,0,-1,0,-2,-2,-1,1,-2,1,-3,3,4,-7,10,-10,17,-8,30,16,515,1931,1146,-1163,-657,824,480,-305,507,3057,4225,2358,815,926,545,-143,-618,-1418,-1608,-1064,-996,-1088,-881,-591,43,664,921,1271,1604,1327,556,-91,-292,-439,-923,-1217,-1105,-1048,-1103,-1044,-891,-665,-302,19,188,270,341,378,256,25,-117,-175,-261,-315,-347,-396,-441,-469,-453,-442,-468,-391,-189,-47,4,24,52,82,46,5,17,25,-24,-92,-121,-164,-200,-194,-238,-292,-309,-253,-165,-150,-122,-72,-55,-76,-123,-135,-128,-123,-103,-104,-125,-147,-165,-153,-157,-141,-95,-63,-44,-49,-26,0,-3,-30,-46,-76,-96,-113,-141,-35}, + {-154,223,-234,135,-100,1838,12616,2913,-17273,-5688,11519,5402,-2662,10638,14618,-5111,-4205,13882,11975,-5528,-10105,-3387,-4598,-6266,-3600,-5100,-8282,-5957,533,2655,226,1556,4413,3707,1940,1722,1412,-1531,-2762,-1241,-808,-1967,-3027,-2261,-1335,-711,-214,-167,-63,0,429,866,803,660,863,784,57,-497,-363,-200,-703,-1056,-901,-817,-887,-713,-166,76,-75,-148,20,260,169,164,500,567,139,-156,-19,-118,-387,-320,-122,-319,-613,-441,-175,-138,-119,102,143,-38,-70,46,123,126,195,124,-84,-271,-283,-147,-73,-74,-202,-345,-480,-473,-220,39,75,-87,-197,-213,-152,-3,114,29,-205,-367,-354,-238,-154,-97,-91,-147,-177,-102,41,113,72,15,-13,-48,-45,22,100,68,-29,-16} + }, + { // 130 degrees, measured left/right ears + {1,2,2,1,1,-2,1,-2,1,0,-1,-2,1,-2,3,0,-2,8,-6,10,-8,18,-6,25,22,449,2106,1584,-1258,-1073,799,601,-396,494,3563,4792,2387,730,1069,517,-395,-798,-1737,-2265,-1614,-1035,-942,-897,-496,138,210,213,936,1543,1335,1009,855,452,15,-281,-533,-889,-1267,-1334,-1316,-1402,-1226,-706,-291,-107,81,351,471,329,235,182,42,-98,-194,-250,-348,-419,-405,-427,-526,-551,-389,-215,-167,-149,-91,4,44,8,33,98,113,68,-22,-100,-141,-159,-161,-202,-285,-316,-290,-234,-175,-148,-121,-96,-96,-123,-156,-145,-94,-61,-51,-80,-133,-162,-166,-136,-114,-90,-74,-71,-51,-35,-28,-35,-50,-79,-92,-111,-106,-100,-122,-31}, + {47,-121,204,-305,372,-421,5307,11817,-5420,-15226,2465,11204,-15,-1076,14447,8793,-6891,3508,15951,4874,-9954,-7121,-1844,-5731,-6293,-3978,-6044,-7512,-3258,1923,1458,-119,2862,4690,2848,1399,1686,670,-1996,-2141,-1088,-1343,-2364,-2543,-1658,-1245,-769,-248,-80,-39,190,720,940,753,724,899,524,-232,-504,-214,-335,-912,-1025,-875,-842,-845,-509,-16,60,-51,-42,192,286,107,216,526,475,44,-98,-36,-298,-482,-302,-191,-477,-622,-354,-150,-158,-25,209,142,-10,15,134,150,146,167,31,-172,-308,-222,-82,-64,-170,-356,-458,-460,-309,-61,50,-50,-165,-159,-77,-10,26,20,-101,-245,-332,-316,-232,-189,-149,-104,-122,-130,-36,100,128,51,32,21,-13,-17,67,99,-14,-17} + }, + { // 135 degrees, measured left/right ears + {3,1,-1,0,-2,0,-2,0,-2,-1,-3,2,-1,-1,0,-3,9,-9,10,-13,16,-2,13,35,398,2256,2024,-1311,-1512,728,698,-500,561,4186,5359,2342,605,1243,577,-662,-1052,-1967,-2731,-2023,-1256,-1267,-1167,-450,421,516,331,716,1064,972,826,759,701,647,357,-87,-370,-643,-1107,-1523,-1610,-1417,-1063,-740,-463,-153,52,194,325,356,325,260,101,-57,-152,-259,-354,-413,-434,-419,-393,-359,-282,-220,-229,-195,-138,-111,-64,21,122,142,78,9,-50,-117,-150,-122,-138,-219,-281,-278,-226,-199,-200,-170,-139,-150,-166,-172,-158,-118,-63,-31,-59,-116,-153,-142,-118,-99,-68,-46,-62,-83,-81,-62,-61,-96,-115,-133,-128,-117,-103,-91,-107,-27}, + {62,-69,38,31,-146,238,80,7898,8373,-9999,-10456,7288,7999,-3821,2355,15565,4164,-4967,9137,13938,-1795,-10527,-3548,-1990,-7308,-6128,-3945,-6525,-6195,-1019,1966,373,368,3837,4416,2004,1143,1575,33,-1995,-1614,-1169,-1776,-2337,-2052,-1436,-1280,-826,-243,-72,3,400,890,933,725,786,796,291,-297,-365,-183,-532,-977,-918,-826,-874,-774,-354,4,22,-14,69,284,279,150,309,468,268,-61,-46,-94,-435,-517,-294,-304,-597,-565,-258,-133,-117,100,262,122,25,100,177,127,122,113,-50,-206,-232,-162,-166,-217,-260,-314,-379,-398,-283,-111,-20,-46,-66,-54,-54,-26,7,-25,-154,-299,-350,-305,-221,-158,-113,-99,-124,-81,41,126,108,61,52,32,-17,-14,44,30,0} + }, + { // 140 degrees, measured left/right ears + {1,-1,0,-3,0,-2,0,-1,0,-3,0,0,-1,2,-4,9,-9,12,-13,12,0,9,43,371,2434,2444,-1363,-1953,642,809,-622,665,4931,5930,2230,502,1424,567,-907,-1233,-2223,-3197,-2371,-1397,-1433,-1420,-728,369,731,573,1039,1361,807,289,416,549,422,363,426,271,-284,-766,-1015,-1339,-1476,-1156,-844,-703,-585,-371,-18,143,217,341,310,173,64,-9,-165,-335,-348,-261,-254,-339,-319,-204,-191,-248,-267,-237,-192,-154,-72,43,101,70,19,-42,-119,-124,-80,-90,-173,-228,-193,-157,-173,-191,-186,-174,-192,-211,-194,-176,-130,-70,-44,-84,-140,-140,-121,-84,-36,-5,-22,-68,-100,-96,-82,-95,-125,-147,-138,-148,-133,-107,-86,-81,-107,-28}, + {-61,92,-112,99,-80,14,9,1029,8963,4714,-11392,-5578,8991,3661,-5231,5998,14960,1540,-1730,11938,9697,-6073,-8397,-1126,-3652,-8465,-5239,-4011,-6713,-4614,300,1434,-209,1279,4382,3601,1457,1179,1279,-413,-1800,-1286,-1276,-1819,-2119,-1862,-1434,-1277,-764,-345,-193,98,602,951,821,720,852,724,185,-260,-270,-255,-669,-959,-795,-714,-790,-733,-337,-23,-37,7,173,352,272,186,350,346,33,-174,-42,-132,-483,-524,-324,-399,-606,-440,-151,-105,-102,140,263,130,86,133,125,61,106,109,-63,-239,-273,-186,-153,-187,-270,-368,-445,-428,-251,-50,10,-50,-59,-21,-16,-38,-67,-124,-228,-303,-300,-237,-175,-157,-123,-95,-81,-21,64,119,94,59,40,-10,-49,-18,29,8} + }, + { // 145 degrees, measured left/right ears + {-1,-2,-5,-1,-4,0,-2,-1,-3,-2,0,-1,1,-5,9,-14,14,-14,8,2,-3,49,365,2647,2841,-1469,-2405,556,919,-748,851,5818,6434,1957,467,1715,458,-1290,-1394,-2389,-3648,-2753,-1495,-1557,-1679,-833,432,656,503,1282,1671,1008,420,284,154,52,96,161,230,112,-280,-775,-1054,-962,-774,-756,-841,-772,-521,-285,-124,11,110,155,114,46,-29,-160,-186,-95,-104,-221,-278,-211,-128,-140,-219,-260,-243,-216,-202,-164,-81,-13,-5,-34,-69,-107,-116,-80,-85,-141,-170,-134,-99,-124,-156,-150,-146,-190,-228,-215,-194,-157,-111,-107,-137,-167,-166,-128,-52,24,40,-1,-78,-126,-125,-106,-105,-134,-150,-162,-163,-157,-115,-91,-85,-97,-126,-32}, + {12,-48,69,-96,106,-118,96,-106,1923,8954,1885,-10785,-1634,8153,-224,-4495,8753,13545,693,1390,12044,5229,-7416,-5450,-602,-5809,-8404,-4204,-4516,-6299,-3154,594,911,-180,2169,4458,2690,1098,1243,1099,-718,-1680,-1038,-1194,-1615,-1948,-1754,-1495,-1372,-718,-454,-320,136,688,958,765,725,905,758,184,-240,-233,-329,-753,-843,-638,-637,-722,-637,-311,-135,-68,81,236,323,184,160,312,268,-71,-274,-140,-218,-448,-421,-297,-424,-542,-313,-91,-106,-82,151,232,127,108,129,81,19,59,27,-89,-144,-134,-138,-224,-301,-360,-396,-410,-352,-194,-50,0,-26,-29,-38,-72,-103,-125,-153,-203,-228,-228,-208,-185,-151,-87,-50,-40,0,71,91,56,25,4,-25,-44,-20,0} + }, + { // 150 degrees, measured left/right ears + {0,-4,0,-2,-2,-3,-1,-5,-1,-1,-1,4,-7,11,-16,13,-16,11,5,-9,51,374,2901,3210,-1613,-2843,459,1029,-858,1097,6827,6890,1555,446,2085,380,-1770,-1635,-2512,-4061,-3102,-1562,-1686,-1896,-903,490,708,523,1336,1793,1109,443,439,357,-126,-325,-151,-25,-191,-388,-448,-649,-710,-457,-382,-486,-558,-507,-337,-290,-247,-126,-64,-127,-245,-201,-70,3,1,-40,-90,-181,-163,-63,-71,-138,-182,-174,-197,-258,-208,-93,-78,-152,-152,-111,-147,-158,-92,-63,-114,-142,-102,-78,-115,-108,-63,-88,-140,-164,-184,-197,-178,-156,-160,-203,-224,-185,-116,-38,28,53,-4,-94,-149,-139,-100,-87,-106,-145,-165,-169,-148,-119,-95,-102,-111,-112,-110,-24}, + {11,1,-29,52,-86,100,-124,118,-125,2503,8424,166,-9136,656,5843,-2494,-2704,10083,12136,1191,3424,10316,2085,-6635,-3256,-1594,-7259,-7394,-3777,-4998,-5414,-2219,358,556,329,2815,4077,1981,907,1296,864,-891,-1423,-973,-1073,-1226,-1718,-1716,-1654,-1495,-750,-544,-425,93,687,937,786,752,922,806,233,-220,-231,-329,-705,-743,-592,-585,-636,-543,-231,-131,-81,57,139,163,72,120,226,131,-117,-219,-142,-284,-463,-329,-201,-364,-434,-229,-92,-139,-87,136,176,105,114,75,-40,-43,105,126,9,-112,-178,-219,-282,-313,-357,-395,-382,-289,-141,-62,-57,-62,-51,-72,-115,-128,-107,-111,-153,-190,-211,-192,-161,-110,-47,-25,-22,-6,36,42,14,7,-6,-50,-68,-15} + }, + { // 155 degrees, measured left/right ears + {-4,-1,-3,-1,0,-1,-4,1,1,0,3,-6,12,-18,16,-16,10,8,-7,48,405,3190,3528,-1806,-3245,382,1105,-958,1446,7893,7254,1071,484,2476,266,-2254,-1951,-2634,-4409,-3494,-1606,-1746,-2128,-941,631,721,490,1506,1970,1098,377,430,416,-37,-279,-303,-381,-514,-628,-690,-720,-572,-223,6,-54,-154,-159,-172,-264,-293,-224,-301,-506,-521,-267,-119,-154,-66,41,-15,-116,-106,18,46,-60,-119,-116,-148,-198,-168,-103,-122,-173,-195,-239,-303,-258,-84,-16,-116,-160,-118,-80,-74,-66,-23,-15,-56,-92,-133,-184,-195,-164,-165,-212,-243,-218,-149,-60,10,15,-65,-157,-175,-125,-64,-50,-79,-122,-158,-159,-133,-110,-100,-108,-131,-134,-107,-61,-9}, + {-12,20,-8,-20,43,-78,101,-129,135,-112,2745,7718,-461,-7209,1208,3323,-3043,-975,10116,11261,2431,4076,7958,680,-4974,-2363,-3108,-7481,-6251,-4005,-5069,-4443,-1814,26,441,927,3085,3475,1591,1016,1207,448,-822,-1043,-965,-1000,-929,-1340,-1605,-1899,-1625,-849,-682,-461,111,648,825,777,870,994,766,222,-84,-100,-354,-691,-631,-527,-534,-534,-428,-186,-99,-77,-78,-59,-17,-67,-1,120,111,-51,-93,-43,-277,-473,-323,-144,-216,-274,-193,-165,-179,-83,107,88,-6,25,69,74,78,111,61,-40,-114,-162,-223,-282,-314,-320,-296,-313,-294,-226,-145,-83,-68,-47,-68,-110,-113,-91,-90,-120,-153,-168,-158,-120,-72,-36,-17,-20,-4,6,-5,-19,-19,-16,-39,-13} + }, + { // 160 degrees, measured left/right ears + {-2,-3,0,-3,-2,-5,0,1,3,3,-5,13,-19,18,-20,15,3,-3,50,468,3537,3753,-2076,-3569,316,1146,-1038,1905,9036,7493,515,619,2870,74,-2724,-2289,-2854,-4688,-3808,-1723,-1814,-2332,-918,836,734,489,1625,2090,1206,381,357,370,-144,-349,-190,-364,-782,-873,-894,-1138,-864,-106,309,248,98,175,251,47,-158,-263,-408,-504,-519,-525,-475,-306,-110,-48,-167,-226,-27,163,115,-7,-36,-31,-84,-148,-132,-38,-34,-160,-248,-318,-390,-336,-174,-88,-146,-190,-120,-62,-80,-45,34,56,10,-70,-133,-172,-142,-97,-116,-175,-243,-242,-178,-101,-48,-71,-153,-233,-226,-131,-35,-9,-34,-88,-136,-139,-112,-84,-95,-125,-151,-153,-124,-65,5,8}, + {15,-18,21,-10,-15,34,-72,96,-128,143,-104,2712,7022,-221,-5604,509,1450,-2462,63,9306,11060,3844,3617,5782,641,-3368,-2602,-4226,-6782,-5635,-4476,-4709,-3583,-1838,-303,772,1247,2722,3058,1686,1094,863,283,-630,-915,-829,-829,-860,-1137,-1359,-1912,-1867,-1106,-707,-353,112,475,657,795,949,1036,784,259,-12,-71,-303,-584,-539,-415,-435,-469,-399,-252,-193,-156,-166,-223,-222,-185,-89,73,164,60,2,-5,-188,-362,-304,-167,-183,-176,-131,-190,-276,-230,-18,72,67,91,69,38,46,62,24,-39,-102,-143,-192,-231,-239,-258,-286,-355,-369,-299,-200,-100,-38,-19,-64,-117,-114,-89,-70,-65,-92,-138,-146,-115,-62,-15,2,-14,-50,-49,-46,-46,-21,-23,-8} + }, + { // 165 degrees, measured left/right ears + {-4,2,-2,-2,-4,1,-1,1,2,-5,12,-23,17,-24,17,-5,4,45,572,3916,3878,-2394,-3799,279,1123,-1080,2457,10124,7638,-17,813,3241,-184,-3180,-2582,-3126,-5015,-4054,-1804,-1889,-2538,-948,1088,832,468,1772,2202,1197,428,410,303,-285,-458,-256,-377,-757,-1076,-1258,-1200,-827,-360,22,267,396,467,446,290,119,54,-28,-355,-696,-693,-545,-428,-340,-326,-336,-292,-118,55,106,80,47,83,25,-93,-31,74,15,-159,-246,-292,-402,-392,-238,-183,-271,-262,-132,-71,-61,13,83,59,-8,-71,-115,-127,-86,-19,-18,-114,-210,-241,-220,-170,-140,-137,-196,-292,-293,-183,-46,13,-7,-46,-94,-104,-77,-66,-83,-119,-149,-164,-144,-82,-11,22,6}, + {-7,16,-19,20,-11,-13,24,-60,86,-116,132,-92,2482,6427,548,-4551,-733,455,-1456,336,8144,11358,5087,2536,4132,1381,-2285,-3321,-4577,-5867,-5510,-4775,-4135,-2967,-2029,-549,1149,1431,2131,2590,1960,1337,570,153,-384,-870,-787,-574,-707,-1196,-1421,-1662,-1728,-1380,-880,-211,176,240,485,813,993,1024,738,340,92,-64,-245,-405,-380,-313,-341,-512,-574,-396,-288,-277,-323,-289,-208,-228,-147,79,243,169,78,22,-178,-284,-179,-99,-194,-291,-265,-219,-245,-217,-46,63,94,68,-7,-57,-41,43,84,47,-42,-112,-162,-201,-231,-267,-309,-379,-402,-349,-224,-99,-45,-31,-64,-103,-102,-63,-23,-29,-82,-127,-135,-106,-43,0,0,-46,-90,-93,-78,-56,-37,-8} + }, + { // 170 degrees, measured left/right ears + {1,-1,-1,-6,3,-3,2,0,-1,11,-24,20,-29,25,-17,13,34,741,4340,3836,-2779,-3891,282,1021,-1073,3160,11114,7627,-437,1094,3508,-502,-3620,-2882,-3377,-5331,-4342,-1902,-1926,-2655,-946,1247,927,548,1912,2335,1221,364,397,302,-322,-537,-293,-500,-1171,-1213,-1002,-1187,-1013,-513,-86,150,250,465,521,407,532,646,288,-276,-525,-518,-569,-640,-571,-457,-502,-553,-318,-29,51,42,42,63,73,74,130,180,86,-86,-205,-316,-428,-406,-236,-186,-316,-356,-226,-106,-69,20,96,34,-51,-74,-60,-44,-16,29,30,-45,-133,-213,-263,-257,-211,-188,-255,-343,-331,-199,-58,-6,-17,-38,-60,-64,-40,-26,-55,-114,-141,-147,-136,-104,-39,-1,-36,-14}, + {6,-8,14,-12,18,-9,-12,22,-49,70,-93,108,-72,2117,5950,1523,-3985,-1986,131,-511,79,6937,11862,6053,1288,3038,2327,-1718,-3951,-4398,-5091,-5562,-4913,-3519,-2531,-2307,-650,1407,1415,1649,2254,2028,1438,769,144,-500,-663,-693,-565,-567,-1188,-1523,-1603,-1476,-1193,-951,-422,107,306,449,707,851,872,780,479,197,48,-133,-293,-309,-302,-390,-607,-739,-578,-379,-351,-401,-335,-174,-95,-19,142,259,210,109,41,-120,-292,-254,-131,-135,-241,-329,-291,-250,-185,-32,37,17,-63,-87,-34,8,79,121,111,33,-87,-173,-233,-266,-268,-292,-362,-426,-396,-248,-100,-31,-38,-72,-81,-64,-27,-2,-20,-67,-105,-111,-92,-57,-16,-16,-67,-121,-119,-90,-71,-15} + }, + { // 175 degrees, measured left/right ears + {-1,-1,-6,4,-3,3,-3,3,8,-23,23,-32,32,-31,29,15,986,4761,3601,-3140,-3815,294,852,-993,3973,11854,7459,-588,1456,3604,-850,-3964,-3217,-3681,-5514,-4604,-2139,-1995,-2666,-860,1359,1003,651,1985,2452,1338,308,311,276,-320,-528,-535,-780,-1064,-1197,-1278,-1286,-919,-479,-184,45,101,179,394,721,947,736,387,110,-126,-310,-569,-654,-553,-594,-758,-782,-495,-172,-38,-32,-34,38,79,98,204,305,206,-7,-143,-293,-425,-377,-209,-181,-324,-350,-247,-187,-161,-52,60,22,-54,-54,-19,7,48,94,89,-2,-127,-209,-260,-268,-246,-251,-318,-390,-356,-212,-69,-14,-22,-50,-55,-49,-18,9,-21,-71,-132,-150,-135,-95,-52,-27,-51,-106,-30}, + {-7,4,-5,11,-9,11,-4,-14,19,-42,55,-70,80,-43,1711,5549,2413,-3689,-2919,156,169,-360,5852,12229,6695,241,2367,3069,-1443,-4246,-3992,-4494,-5636,-4894,-2927,-2294,-2529,-658,1511,1217,1243,2161,2114,1380,697,397,-176,-835,-743,-385,-598,-1185,-1447,-1540,-1474,-1034,-633,-406,-165,181,564,617,555,770,870,656,309,79,-44,-303,-431,-374,-465,-725,-861,-679,-463,-372,-304,-217,-113,-39,101,309,351,181,23,-49,-180,-319,-272,-118,-102,-213,-304,-315,-319,-265,-90,20,13,-47,-68,-32,11,94,160,148,46,-92,-201,-264,-266,-256,-295,-383,-434,-385,-241,-101,-39,-33,-65,-76,-55,-16,19,9,-43,-102,-128,-118,-74,-42,-31,-79,-126,-119,-101,-22} + }, + { // 180 degrees, measured left/right ears + {-2,-6,5,-5,6,-6,6,2,-20,20,-36,42,-50,51,-13,1314,5166,3131,-3449,-3526,253,600,-765,4872,12260,7150,-396,1876,3489,-1191,-4210,-3566,-4059,-5625,-4774,-2483,-2126,-2633,-730,1471,1071,901,2067,2314,1397,470,306,194,-481,-869,-544,-530,-1144,-1372,-1380,-1443,-1040,-437,-101,-109,-159,251,710,684,675,828,722,347,-25,-217,-341,-457,-533,-633,-813,-888,-627,-343,-271,-209,-63,40,34,94,271,376,220,-34,-132,-217,-324,-297,-176,-142,-268,-346,-286,-268,-263,-132,38,66,-30,-71,-54,5,103,171,150,10,-131,-208,-251,-265,-273,-291,-353,-415,-373,-231,-87,-29,-37,-50,-66,-47,-7,23,11,-54,-110,-144,-135,-100,-42,-27,-73,-119,-125,-28}, + {-2,-6,5,-5,6,-6,6,2,-20,20,-36,42,-50,51,-13,1314,5166,3131,-3449,-3526,253,600,-765,4872,12260,7150,-396,1876,3489,-1191,-4210,-3566,-4059,-5625,-4774,-2483,-2126,-2633,-730,1471,1071,901,2067,2314,1397,470,306,194,-481,-869,-544,-530,-1144,-1372,-1380,-1443,-1040,-437,-101,-109,-159,251,710,684,675,828,722,347,-25,-217,-341,-457,-533,-633,-813,-888,-627,-343,-271,-209,-63,40,34,94,271,376,220,-34,-132,-217,-324,-297,-176,-142,-268,-346,-286,-268,-263,-132,38,66,-30,-71,-54,5,103,171,150,10,-131,-208,-251,-265,-273,-291,-353,-415,-373,-231,-87,-29,-37,-50,-66,-47,-7,23,11,-54,-110,-144,-135,-100,-42,-27,-73,-119,-125,-28} + } +}; +} // namespace armix::sonku::hrir diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h new file mode 100644 index 000000000..7ae0b7f68 --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "SonKuMeasuredHrir.h" +#include +#include +#include +#include +#include + +// Headphone binaural DSP: measured MIT KEMAR FIR, not a stereo auto-panner. +// All storage is fixed. prepare/setSettings are CONTROL-side before live render; +// process is the same native FX callback as other inserts (no own device/worker). +namespace armix::sonku { +struct Settings { + float startAzimuthDegrees = 0.f; // FRONT; +90 RIGHT; 180 REAR; -90 LEFT + float revolutionSeconds = 12.f; + float stereoSpreadDegrees = 60.f; + float spatialMix = 1.f; // 1=HRTF; 0=original L/R + float outputTrim = 0.75f; // avoid summing two uncorrelated emitters at unity + bool moving = true; + bool clockwise = true; +}; +inline bool valid(const Settings& s) noexcept { + return std::isfinite(s.startAzimuthDegrees) && + std::abs(s.startAzimuthDegrees)<=360.f && + std::isfinite(s.revolutionSeconds) && s.revolutionSeconds>=0.5f && + s.revolutionSeconds<=120.f && + std::isfinite(s.stereoSpreadDegrees) && s.stereoSpreadDegrees>=0.f && + s.stereoSpreadDegrees<=180.f && + std::isfinite(s.spatialMix) && s.spatialMix>=0.f && s.spatialMix<=1.f && + std::isfinite(s.outputTrim) && s.outputTrim>=0.f && s.outputTrim<=1.f; +} +inline double wrapDegrees(double degrees) noexcept { + degrees=std::fmod(degrees,360.0); + return degrees<0.?degrees+360.:degrees; +} +class SonKuSpatialCore final { +public: + static constexpr int taps=hrir::taps; + static constexpr int updateInterval=16; + bool prepare(double rate) noexcept { + ready_=false; + if(!std::isfinite(rate) || (std::abs(rate-44100.)>.1 && + std::abs(rate-48000.)>.1))return false; + sampleRate_=rate; + bank_=(std::abs(rate-44100.)<.1)?hrir::normal44100:hrir::normal48000; + reset(); + ready_=true; + return true; + } + void reset() noexcept { + for(auto& channel:history_)channel.fill(0.f); + for(auto& source:kernels_)for(auto& ear:source)ear.fill(0.f); + write_=0; + remaining_=0; + degrees_=wrapDegrees(settings_.startAzimuthDegrees); + haveKernel_=false; + } + bool setSettings(const Settings& s) noexcept { + if(!valid(s))return false; + // Keep phase continuous for live speed/spread adjustments; changing start + // position while static is an intentional absolute reposition. + if(!s.moving || !settings_.moving || + s.startAzimuthDegrees!=settings_.startAzimuthDegrees) + degrees_=wrapDegrees(s.startAzimuthDegrees); + settings_=s; + remaining_=0; + return true; + } + Settings settings() const noexcept {return settings_;} + bool ready() const noexcept {return ready_;} + double azimuthDegrees() const noexcept {return degrees_;} + // In-place stereo; caller owns valid, non-overlapping L/R PCM pointers. + // No vector, heap, blocking calls, I/O or filter bank allocation. + void process(float* left,float* right,int samples) noexcept { + if(!ready_ || !left || !right || samples<=0)return; + const double step=(settings_.moving ? + (settings_.clockwise?1.:-1.)*360./(sampleRate_*settings_.revolutionSeconds) : 0.); + const float wetLevel=0.5f*settings_.outputTrim; + const float dryLevel=1.f-settings_.spatialMix; + const float binauralLevel=settings_.spatialMix*wetLevel; + for(int i=0;i=360.)degrees_-=360.; + if(degrees_<0.)degrees_+=360.; + } + --remaining_; + } + } +private: + // Positive azimuth is right. MIT KEMAR supplied azimuth 0..180 with + // symmetric opposite-ear swapping for left hemisphere, not yaw-panning. + void interpolate(std::size_t source,double azimuth) noexcept { + const double norm=wrapDegrees(azimuth); + const bool swapped=norm>180.; + const double positive=swapped?360.-norm:norm; + const double index=positive/static_cast(hrir::spacingDegrees); + const int lo=std::clamp(static_cast(index),0,hrir::directions-1); + const int hi=std::min(lo+1,hrir::directions-1); + const float u=static_cast(index-static_cast(lo)); + constexpr float scale=1.f/32768.f; + for(int ear=0;ear<2;++ear) { + const int measuredEar=swapped?1-ear:ear; + for(int k=0;k(bank_[lo][measuredEar][k])*(1.f-u) + + static_cast(bank_[hi][measuredEar][k])*u); + // Small bounded coefficient smoothing prevents abrupt filter + // switches on motion/edits. No interpolating filter ownership. + auto& current=kernels_[source][ear][k]; + current=haveKernel_?(current*0.65f+next*0.35f):next; + } + } + } + void updateKernels() noexcept { + interpolate(0,degrees_-static_cast(settings_.stereoSpreadDegrees)*0.5); + interpolate(1,degrees_+static_cast(settings_.stereoSpreadDegrees)*0.5); + haveKernel_=true; + } + using Bank=const std::int16_t (*)[2][taps]; + Bank bank_=nullptr; + std::array,2> history_{}; + std::array,2>,2> kernels_{}; + Settings settings_{}; + double sampleRate_=0.; + double degrees_=0.; + int write_=0; + int remaining_=0; + bool ready_=false; + bool haveKernel_=false; +}; +} // namespace armix::sonku diff --git a/scripts/compose_native_peq.py b/scripts/compose_native_peq.py index c67ef6cac..c2d38fac0 100644 --- a/scripts/compose_native_peq.py +++ b/scripts/compose_native_peq.py @@ -7,6 +7,7 @@ COMP_SCRIPT='' HARMONY_SCRIPT='' THROW_SCRIPT='' +SONKU_SCRIPT='' PRESET_SCRIPT='' PICKER_HEAD="function renderFastPicker(){" @@ -95,6 +96,26 @@ refreshStrip(t);setFastPicker(false); say('Vocal Throw · browser preview ONLY · no audio DSP');return true; } +function insertChosenNativeSonKu(){ + const t=tracks.concat(master).find(x=>x.id===activeFxTarget?.channelId); + const slot=Number(activeFxTarget?.slot); + if(!t||!Number.isInteger(slot)||slot<0||slot>=8){ + say('8D-SonKu · choose an empty FX insert');return false; + } + if(window.__JUCE__?.backend?.emitEvent){ + if(!window.ArSonMixNativeSonKu?.insert){ + say('8D-SonKu native FX host unavailable');return false; + } + return window.ArSonMixNativeSonKu.insert(activeFxTarget); + } + if(t.fx[slot]!=='None'){ + say('FX slot already occupied');return false; + } + t.fx[slot]='8D-SonKu';t.slotBypass[slot]=false; + t.fxInsertIds[slot]={id:'visual-sonku-'+t.id+'-'+slot,name:'8D-SonKu'}; + refreshStrip(t);setFastPicker(false); + say('8D-SonKu · browser visual preview ONLY · no audio');return true; +} function renderFastPicker(){""" PICKER_RENDER="plugEl('fastResults').innerHTML=list.length?list.map(p=>" PICKER_RENDER_NEW="""const eqBuiltin=!q||['parametric eq','peq','channel eq','built-in fx'].some(n=>n.includes(q))? @@ -105,7 +126,9 @@ '':''; const throwBuiltin=!q||['vocal throw','throw','delay','echo','phrase','concert','built-in fx'].some(n=>n.includes(q))? '':''; - const builtin=(eqBuiltin||compBuiltin||harmonyBuiltin||throwBuiltin?'
BUILT-IN FX
':'')+eqBuiltin+compBuiltin+harmonyBuiltin+throwBuiltin; + const sonkuBuiltin=!q||['8d-sonku','sonku','8d','binaural','spatial','orbit','built-in fx'].some(n=>n.includes(q))? + '':''; + const builtin=(eqBuiltin||compBuiltin||harmonyBuiltin||throwBuiltin||sonkuBuiltin?'
BUILT-IN FX
':'')+eqBuiltin+compBuiltin+harmonyBuiltin+throwBuiltin+sonkuBuiltin; plugEl('fastResults').innerHTML=builtin+'
VST3 PLUGINS
'+(list.length?list.map(p=>""" PICKER_END=""").join(''):'
No matching effects
';""" PICKER_END_NEW=""").join(''):'
No matching effects
');""" @@ -114,9 +137,10 @@ if(e.target.closest('[data-fast-native-eq]')){insertChosenNativeEq();return;} if(e.target.closest('[data-fast-native-comp]')){insertChosenNativeCompressor();return;} if(e.target.closest('[data-fast-native-throw]')){insertChosenNativeThrow();return;} + if(e.target.closest('[data-fast-native-sonku]')){insertChosenNativeSonKu();return;} const btn=e.target.closest('[data-fast-id]');if(btn)insertCatalogPlugin(btn.dataset.fastId);""" PICKER_ENTER="if(b){e.preventDefault();insertCatalogPlugin(b.dataset.fastId);}" -PICKER_ENTER_NEW="if(b){e.preventDefault();if(b.hasAttribute('data-fast-native-harmony'))insertChosenNativeHarmony();else if(b.hasAttribute('data-fast-native-throw'))insertChosenNativeThrow();else if(b.hasAttribute('data-fast-native-eq'))insertChosenNativeEq();else if(b.hasAttribute('data-fast-native-comp'))insertChosenNativeCompressor();else insertCatalogPlugin(b.dataset.fastId);}" +PICKER_ENTER_NEW="if(b){e.preventDefault();if(b.hasAttribute('data-fast-native-harmony'))insertChosenNativeHarmony();else if(b.hasAttribute('data-fast-native-throw'))insertChosenNativeThrow();else if(b.hasAttribute('data-fast-native-eq'))insertChosenNativeEq();else if(b.hasAttribute('data-fast-native-comp'))insertChosenNativeCompressor();else if(b.hasAttribute('data-fast-native-sonku'))insertChosenNativeSonKu();else insertCatalogPlugin(b.dataset.fastId);}" OPEN=" if(a==='openPlugin'){openFastPicker(t,Number(btn.dataset.slot),btn);return;}" OPEN_NEW=""" if(a==='openPlugin'){ const index=Number(btn.dataset.slot); @@ -132,6 +156,9 @@ if(t.fx[index]==='ArSon Vocal Throw'){ window.ArSonMixNativeVocalThrow?.open(t,index);return; } + if(t.fx[index]==='8D-SonKu'){ + window.ArSonMixNativeSonKu?.open(t,index);return; + } openFastPicker(t,index,btn);return; }""" def apply_native_peq(html: str)->str: @@ -142,11 +169,11 @@ def apply_native_peq(html: str)->str: (PICKER_ENTER,PICKER_ENTER_NEW), (OPEN,OPEN_NEW)) if html.count('')!=1 or html.count('')!=1 or \ - SCRIPT in html or COMP_SCRIPT in html or HARMONY_SCRIPT in html or THROW_SCRIPT in html or PRESET_SCRIPT in html or 'insertChosenNativeEq' in html: + SCRIPT in html or COMP_SCRIPT in html or HARMONY_SCRIPT in html or THROW_SCRIPT in html or PRESET_SCRIPT in html or SONKU_SCRIPT in html or 'insertChosenNativeEq' in html: raise ValueError("Parametric EQ requires one pristine approved compiled GUI") for before,after in anchors: if html.count(before)!=1: raise ValueError('Ambiguous approved picker/editor anchor: '+before[:90]) html=html.replace(before,after,1) - html=html.replace('',PRESET_SCRIPT+'\n'+SCRIPT+'\n'+COMP_SCRIPT+'\n'+HARMONY_SCRIPT+'\n'+THROW_SCRIPT+'\n',1) + html=html.replace('',PRESET_SCRIPT+'\n'+SCRIPT+'\n'+COMP_SCRIPT+'\n'+HARMONY_SCRIPT+'\n'+THROW_SCRIPT+'\n'+SONKU_SCRIPT+'\n',1) return html diff --git a/site/preview-v2/assets/mixer-fx-rack.css b/site/preview-v2/assets/mixer-fx-rack.css index 2328ef9dd..9456b650f 100644 --- a/site/preview-v2/assets/mixer-fx-rack.css +++ b/site/preview-v2/assets/mixer-fx-rack.css @@ -1157,3 +1157,52 @@ .mx-peq .mx-fxp-save-as::before{content:"+";font-size:14px} .mx-peq .mx-fxp-manage{min-width:23px;padding:0} } + +/* 8D-SonKu editor: inherits the existing approved FX Rack CSS owner. */ +.mx-sonku[hidden]{display:none!important} +.mx-sonku{position:fixed;z-index:1300;top:9%;left:50%;transform:translateX(-50%); + width:min(680px,calc(100vw - 22px));max-height:88vh;overflow:auto; + color:#dcecf3;background:#142230;border:1px solid #426077;border-radius:12px; + box-shadow:0 18px 52px #000b,0 2px 10px #0009;font:400 12px/1.45 inherit} +.mx-sonku button,.mx-sonku input{font:inherit} +.mx-sonku button{cursor:pointer;color:inherit} +.mx-sonku .sk-head{display:flex;align-items:center;gap:12px;padding:10px 13px; + min-height:42px;background:linear-gradient(#20384b,#172633);border-bottom:1px solid #3d5666} +.mx-sonku .sk-brand{font-size:16px;font-weight:600;letter-spacing:.3px;color:#f3f9ff} +.mx-sonku .sk-brand span{color:#56c3d7} +.mx-sonku .sk-headnote{font-size:10px;letter-spacing:1.2px;color:#91acba} +.mx-sonku .sk-channel{margin-left:auto;font-size:11px;color:#b1cad8;white-space:nowrap} +.mx-sonku .sk-close{border:1px solid #526878;background:#233849;border-radius:6px;width:25px;height:25px;font-size:20px;line-height:1} +.mx-sonku .sk-content{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(160px,1fr);gap:12px;padding:12px} +.mx-sonku .sk-stage{min-width:0} +.mx-sonku .sk-stage svg{display:block;width:100%;height:auto;border:1px solid #31495b;border-radius:9px} +.mx-sonku .sk-stage text{font-family:inherit;font-size:10px;fill:#90adbb;letter-spacing:1px} +.mx-sonku .sk-stage .sk-source-label{font-size:11px;font-weight:600;fill:#5dd0e8} +.mx-sonku .sk-stage .sk-right .sk-source-label{fill:#e4a5d7} +.mx-sonku .sk-source-bg{fill:#153344;stroke:#61d6e8;stroke-width:2} +.mx-sonku .sk-source-core{fill:#61d6e8} +.mx-sonku .sk-right .sk-source-bg{fill:#3b243a;stroke:#e2a8d9} +.mx-sonku .sk-right .sk-source-core{fill:#e2a8d9} +.mx-sonku .sk-src{cursor:grab;outline:none} +.mx-sonku .sk-src:focus .sk-source-bg{stroke-width:4} +.mx-sonku .sk-src:active{cursor:grabbing} +.mx-sonku .sk-stage-caption{font-size:9px;letter-spacing:.6px;color:#7294a5;text-align:center;margin-top:5px} +.mx-sonku .sk-controls{min-width:0;padding:2px 4px;display:flex;flex-direction:column;gap:12px} +.mx-sonku .sk-control-title{font-size:10px;letter-spacing:1.3px;color:#8dcadd} +.mx-sonku .sk-buttons{display:flex;gap:6px} +.mx-sonku .sk-buttons button{font-size:10px;line-height:1.2;flex:1;padding:7px 5px;border-radius:6px; + border:1px solid #537181;background:#233949;color:#bed6df} +.mx-sonku .sk-buttons button[aria-pressed="true"]{border-color:#54adbf;box-shadow:inset 0 0 7px #1e6578;color:#e6fafc} +.mx-sonku .sk-controls label{display:grid;grid-template-columns:1fr auto;gap:5px;font-size:10px;letter-spacing:.6px;color:#a6c2cf} +.mx-sonku .sk-controls label output{font-variant-numeric:tabular-nums;color:#e1f6fa} +.mx-sonku .sk-controls label input{grid-column:1/-1;width:100%;margin:3px 0 0;accent-color:#5fc8db;height:14px} +.mx-sonku .sk-guide{font-size:11px;color:#88a6b8;line-height:1.5;margin-top:auto} +.mx-sonku .sk-status{display:flex;justify-content:space-between;gap:10px;border-top:1px solid #3a5364; + padding:8px 13px;color:#97bac8;font-size:10px;letter-spacing:.3px} +.mx-sonku #skHint{text-align:right} +@media(max-width:550px){.mx-sonku{top:10px;max-height:calc(100vh - 20px)} + .mx-sonku .sk-content{grid-template-columns:1fr} + .mx-sonku .sk-headnote{display:none} + .mx-sonku .sk-stage svg{max-height:38vh} + .mx-sonku .sk-controls{gap:8px} +} diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js new file mode 100644 index 000000000..b1200c855 --- /dev/null +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -0,0 +1,219 @@ +/* 8D-SonKu. Presentation only: native JUCE remains the ONLY PCM authority. + No WebAudio, source simulation, optimistic DSP success or second /preview/. */ +(() => { +"use strict"; +const ID="armix.builtin.8d-sonku.v1"; +const defaults=()=>({startAzimuthDegrees:0,revolutionSeconds:12, + stereoSpreadDegrees:60,spatialMix:1,outputTrim:.75,moving:true,clockwise:true}); +const valid=s=>s && Number.isFinite(s.startAzimuthDegrees) && + Math.abs(s.startAzimuthDegrees)<=360 && + Number.isFinite(s.revolutionSeconds)&&s.revolutionSeconds>=.5&&s.revolutionSeconds<=120 && + Number.isFinite(s.stereoSpreadDegrees)&&s.stereoSpreadDegrees>=0&&s.stereoSpreadDegrees<=180 && + Number.isFinite(s.spatialMix)&&s.spatialMix>=0&&s.spatialMix<=1 && + Number.isFinite(s.outputTrim)&&s.outputTrim>=0&&s.outputTrim<=1 && + typeof s.moving==="boolean"&&typeof s.clockwise==="boolean"; +const backend=()=>window.__JUCE__?.backend; +const native=()=>typeof backend()?.emitEvent==="function"; +const snapshot=()=>window.__ARMIX_NATIVE_M2__?.fxEditorState?.()|| + window.__ARMIX_NATIVE_M2__?.state?.()?.current; +const angle=(v)=>((v%360)+360)%360; +const root=document.createElement("section"); +root.id="mxNativeSonKu";root.className="mx-sonku";root.hidden=true; +root.setAttribute("role","dialog");root.setAttribute("aria-modal","false"); +root.setAttribute("aria-label","8D-SonKu binaural spatial audio"); +root.innerHTML=[ + '
8D·SonKu', + 'BINAURAL SPATIAL MOTION', + '', + '
', + '
', + '', + '', + '', + '', + '', + '', + 'FRONT', + 'REAR', + 'LEFTRIGHT', + '', + '', + '', + '', + '', + '', + '', + 'L', + '', + '', + 'R', + '
HEADPHONES · HRIR 0° ELEVATION · 44.1 / 48 kHz
', + '
', + '
VISUAL PREVIEWNo browser audio
' +].join(""); +const $=id=>root.querySelector("#"+id); +const mount=()=>{if(!root.isConnected)document.body.append(root)}; +if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",mount,{once:true});else mount(); +let current=null,accepted=defaults(),draft=defaults(),pending=null,latest=null, + readId="",seq=1,clock=null,observed=0,observedAt=0,drag=null; +const context=()=>{ + if(!current||!native())return null; + const s=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(current.track); + const ch=s?.graph?.channels?.find(x=>x.id===id); + const fx=ch?.inserts?.[current.slot]; + if(!(s?.admitted||s?.logical)||!id||fx?.catalogId!==ID||!fx?.id || + (current.instanceId&¤t.instanceId!==fx.id))return null; + return {channelId:id,slot:current.slot,instanceId:fx.id, + deviceEpoch:s.logical?"0":s.device.epoch, + ...(s.logical?{workspaceToken:s.workspaceToken}:{}),graphRevision:s.graph.revision}; +}; +function render(){ + const s=draft; + $("skMotion").textContent=s.moving?"ORBIT":"STATIC"; + $("skMotion").setAttribute("aria-pressed",String(s.moving)); + $("skDirection").textContent=s.clockwise?"CLOCKWISE":"COUNTER-CW"; + $("skDirection").setAttribute("aria-pressed",String(s.clockwise)); + const vals=[["skSpeed",s.revolutionSeconds,"skSpeedValue",s.revolutionSeconds.toFixed(1)+" s"], + ["skSpread",s.stereoSpreadDegrees,"skSpreadValue",Math.round(s.stereoSpreadDegrees)+"°"], + ["skMix",s.spatialMix*100,"skMixValue",Math.round(s.spatialMix*100)+"%"], + ["skTrim",s.outputTrim*100,"skTrimValue",Math.round(s.outputTrim*100)+"%"]]; + for(const [input,value,out,label] of vals){$(input).value=String(value);$(out).textContent=label;} + const liveMotion=s.moving&¤t&&!pending?observed: + s.startAzimuthDegrees; + const phase=native()&&s.moving&¤t&&!pending&&observedAt? + liveMotion+(performance.now()-observedAt)*.001* + (s.clockwise?1:-1)*360/s.revolutionSeconds:liveMotion; + for(let source=0;source<2;++source){ + const deg=angle(phase+(source?1:-1)*s.stereoSpreadDegrees/2); + const rad=deg*Math.PI/180; + const x=200+120*Math.sin(rad),y=165-120*Math.cos(rad); + const g=root.querySelector('.sk-src[data-index="'+source+'"]'); + const bg=g.querySelector(".sk-source-bg"),dot=g.querySelector(".sk-source-core"),label=g.querySelector(".sk-source-label"); + for(const c of [bg,dot]){c.setAttribute("cx",x.toFixed(2));c.setAttribute("cy",y.toFixed(2));} + label.setAttribute("x",x.toFixed(2));label.setAttribute("y",(y-22).toFixed(2)); + g.setAttribute("aria-valuenow",String(Math.round(deg>180?deg-360:deg))); + } + $("skMode").textContent=native()?(context()?"NATIVE HRTF":"NATIVE UNAVAILABLE"):"VISUAL ONLY · NO AUDIO"; +} +function hint(s){$("skHint").textContent=s;} +function requestSnapshot(){ + const c=context();if(!c)return; + readId="sk-read-"+String(Date.now())+"-"+(++seq); + backend().emitEvent("arMixAction",{action:"nativeSonKuSnapshot",requestId:readId,...c}); +} +function send(next){ + if(!valid(next))return false; + draft={...next};render(); + if(!native()){accepted={...next};hint("BROWSER VISUAL ONLY · NO DSP");return true;} + if(pending){latest={...next};hint("DSP BUSY · FINAL CHANGE HELD");return true;} + const c=context();if(!c){hint("NATIVE INSERT NOT ACCEPTED");return false;} + const id="sonku-"+String(Date.now()*1000+(++seq%1000)); + pending={requestId:id,settings:{...next},context:c,ack:false}; + backend().emitEvent("arMixAction",{action:"nativeSonKuSet",requestId:id,...c,settings:next}); + hint("DSP QUEUED · AWAITING AUDIO ACK");return true; +} +function flushLatest(){ + if(latest){const next=latest;latest=null;send(next);} +} +function finishFailure(reason){ + pending=null;latest=null;draft={...accepted};hint(reason);render();requestSnapshot(); +} +backend()?.addEventListener?.("arMixBuiltinSonKuQueue",r=>{ + if(!pending||r?.requestId!==pending.requestId)return; + if(r.status==="REJECTED")finishFailure("DSP REJECTED · "+(r.errorCode||"STALE")); +}); +backend()?.addEventListener?.("arMixBuiltinSonKuAck",r=>{ + if(!pending||r?.requestId!==pending.requestId)return; + if(r.status!=="APPLIED")return finishFailure("DSP NOT APPLIED · "+(r.errorCode||"STALE")); + pending.ack=true;hint("DSP APPLIED · VERIFYING READBACK");requestSnapshot(); +}); +backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ + if(r?.requestId!==readId||!current)return; + const c=context();if(!c||r.status!=="ACCEPTED"|| + r.channelId!==c.channelId||r.instanceId!==c.instanceId)return; + if(!valid(r.settings))return; + if(pending) { + if(!pending.ack || r.appliedRequestId!==pending.requestId)return; + accepted={...r.settings};pending=null;hint("DSP APPLIED · ACCEPTED");flushLatest(); + }else if(!drag){ + accepted={...r.settings};draft={...r.settings}; + } + if(Number.isFinite(r.observedAzimuthDegrees)){ + observed=r.observedAzimuthDegrees;observedAt=performance.now(); + } + render(); +}); +$("skClose").addEventListener("click",()=>{root.hidden=true;current=null; + pending=null;latest=null;if(clock!==null){clearInterval(clock);clock=null;}}); +$("skMotion").addEventListener("click",()=>send({...draft,moving:!draft.moving})); +$("skDirection").addEventListener("click",()=>send({...draft,clockwise:!draft.clockwise})); +for(const [id,key,convert] of [ + ["skSpeed","revolutionSeconds",v=>v], + ["skSpread","stereoSpreadDegrees",v=>v], + ["skMix","spatialMix",v=>v/100], + ["skTrim","outputTrim",v=>v/100]]) { + const input=$(id); + input.addEventListener("input",()=>{const v=Number(input.value); + if(!Number.isFinite(v))return;draft={...draft,[key]:convert(v)};render();}); + input.addEventListener("change",()=>send({...draft,[key]:convert(Number(input.value))})); +} +const map=$("skMap"); +function toAzimuth(e) { + const rect=map.getBoundingClientRect(); + const x=(e.clientX-rect.left)*400/rect.width-200; + const y=165-(e.clientY-rect.top)*330/rect.height; + return Math.atan2(x,y)*180/Math.PI; +} +map.addEventListener("pointerdown",e=>{ + const g=e.target.closest(".sk-src");if(!g)return; + drag={source:Number(g.dataset.index)}; + map.setPointerCapture?.(e.pointerId);e.preventDefault(); +}); +map.addEventListener("pointermove",e=>{ + if(!drag)return; + const value=toAzimuth(e)-(drag.source?1:-1)*draft.stereoSpreadDegrees/2; + draft={...draft,startAzimuthDegrees:Math.max(-360,Math.min(360,value)), + moving:false};render(); +}); +map.addEventListener("pointerup",e=>{ + if(!drag)return;drag=null;map.releasePointerCapture?.(e.pointerId); + send({...draft}); +}); +map.addEventListener("pointercancel",()=>{drag=null;draft={...accepted};render();}); +map.addEventListener("keydown",e=>{ + const g=e.target.closest(".sk-src");if(!g)return; + if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key))return; + e.preventDefault(); + const step=(e.key==="ArrowLeft"||e.key==="ArrowDown"?-5:5); + send({...draft,startAzimuthDegrees:Math.max(-360,Math.min(360,draft.startAzimuthDegrees+step)),moving:false}); +}); +const api={ + id:ID, + insert(target){return Boolean(window.__ARMIX_NATIVE_M2__?.insertPlugin?.(ID,target));}, + open(track,slot){ + pending=null;latest=null;accepted=defaults();draft=defaults(); + current={track,slot,instanceId:null}; + const s=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(track); + const fx=s?.graph?.channels?.find(x=>x.id===id)?.inserts?.[slot]; + if(native()&&(s?.admitted||s?.logical)&&fx?.catalogId===ID)current.instanceId=fx.id; + $("skChannel").textContent=String(track.name)+" · FX "+(slot+1); + root.hidden=false; + hint(native()?"READING ACCEPTED DSP":"BROWSER VISUAL ONLY · NO AUDIO"); + if(native())requestSnapshot(); + if(clock!==null)clearInterval(clock); + clock=setInterval(()=>{if(root.hidden)return; + if(native()&&!pending&&context())requestSnapshot(); + render();},250); + render(); + }, + close(){$("skClose").click();} +}; +window.ArSonMixNativeSonKu=Object.freeze(api); +})(); diff --git a/src/Main.cpp b/src/Main.cpp index 7fe296f6d..593a5dc3b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -494,6 +494,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr } pendingNativeHarmony_; juce::String lastNativeHarmonyRequest_,lastNativeHarmonyInstance_; juce::String lastNativeHarmonyEpoch_,lastNativeHarmonyRevision_; + struct PendingNativeSonKu { + armix::mixer::LiveChannelFxGraph::InstanceLease owner; + juce::String request,channelId,deviceEpoch,revision,instanceId; + juce::uint32 started=0; + } pendingNativeSonKu_; + juce::String lastNativeSonKuRequest_,lastNativeSonKuInstance_; + juce::String lastNativeSonKuEpoch_,lastNativeSonKuRevision_; struct PendingNativeThrow { armix::mixer::LiveChannelFxGraph::InstanceLease owner; juce::String request,channelId,deviceEpoch,revision,instanceId; @@ -2945,6 +2952,84 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr "arMixBuiltinCompAck",juce::var(ack.release())); } + // SonKu Native FX: one editor target = exact ChannelId/slot/instance/epoch. + // Snapshot reads accepted CONTROL settings only; the single atomically + // published angle is observation, never another audio motion clock. + void emitNativeSonKuSnapshot(const juce::String& request, + const juce::String& channelId,const juce::String& epoch, + const juce::String& revision,const juce::String& instanceId, + armix::builtin_fx::SonKuSpatialProcessor* processor) { + auto reply=std::make_unique(); + reply->setProperty("requestId",request); + reply->setProperty("channelId",channelId); + reply->setProperty("deviceEpoch",epoch); + reply->setProperty("graphRevision",revision); + reply->setProperty("instanceId",instanceId); + reply->setProperty("schemaVersion",1); + reply->setProperty("status",processor?"ACCEPTED":"REJECTED"); + if(processor) { + const auto s=processor->acceptedSettings(); + auto values=std::make_unique(); + values->setProperty("startAzimuthDegrees",s.startAzimuthDegrees); + values->setProperty("revolutionSeconds",s.revolutionSeconds); + values->setProperty("stereoSpreadDegrees",s.stereoSpreadDegrees); + values->setProperty("spatialMix",s.spatialMix); + values->setProperty("outputTrim",s.outputTrim); + values->setProperty("moving",s.moving); + values->setProperty("clockwise",s.clockwise); + reply->setProperty("settings",juce::var(values.release())); + reply->setProperty("observedAzimuthDegrees", + processor->observedAzimuthDegrees()); + if(epoch=="0" && instanceId==lastLogicalFxInstance_ && + revision==lastLogicalFxRevision_) + reply->setProperty("appliedRequestId",lastLogicalFxRequest_); + else if(instanceId==lastNativeSonKuInstance_ && + epoch==lastNativeSonKuEpoch_ && + revision==lastNativeSonKuRevision_) + reply->setProperty("appliedRequestId",lastNativeSonKuRequest_); + } else reply->setProperty("error","SONKU_INSTANCE_OR_REVISION_UNAVAILABLE"); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixBuiltinSonKuSnapshot",juce::var(reply.release())); + } + + void servicePendingNativeSonKu() { + if(!pendingNativeSonKu_.owner)return; + auto* processor=dynamic_cast( + pendingNativeSonKu_.owner->processor.get()); + if(!processor){pendingNativeSonKu_={};return;} + armix::builtin_fx::SonKuSpatialProcessor::Completion result{}; + const bool complete=processor->pollCompletion(result); + if(!complete && juce::Time::getMillisecondCounter()- + pendingNativeSonKu_.started<3000u)return; + const auto request=pendingNativeSonKu_.request; + bool applied=complete&&result.applied&&result.requestId!=0 && + request=="sonku-"+juce::String(std::to_string(result.requestId)); + const auto snap=approvedNativeSnapshot(); + const auto device=snap.getProperty("device",{}); + const auto graph=snap.getProperty("graph",{}); + applied=applied&&pendingNativeSonKu_.deviceEpoch== + device.getProperty("epoch","").toString()&& + pendingNativeSonKu_.revision== + graph.getProperty("revision","").toString(); + if(applied) { + lastNativeSonKuRequest_=request; + lastNativeSonKuInstance_=pendingNativeSonKu_.instanceId; + lastNativeSonKuEpoch_=pendingNativeSonKu_.deviceEpoch; + lastNativeSonKuRevision_=pendingNativeSonKu_.revision; + } + auto ack=std::make_unique(); + ack->setProperty("requestId",request); + ack->setProperty("channelId",pendingNativeSonKu_.channelId); + ack->setProperty("deviceEpoch",pendingNativeSonKu_.deviceEpoch); + ack->setProperty("graphRevision",pendingNativeSonKu_.revision); + ack->setProperty("instanceId",pendingNativeSonKu_.instanceId); + ack->setProperty("status",applied?"APPLIED":"REJECTED"); + ack->setProperty("errorCode",applied?"NONE":"SONKU_EDIT_NOT_APPLIED_OR_STALE"); + pendingNativeSonKu_={}; + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixBuiltinSonKuAck",juce::var(ack.release())); + } + // One channel/slot/epoch/revision-bound Harmony state. No browser DSP. void emitNativeHarmonySnapshot(const juce::String& request, const juce::String& channelId,const juce::String& epoch, @@ -3987,6 +4072,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr action == "routingNativeFxInsertBypass" || action == "routingFxRackBypass" || action == "nativeEqSetBand" || action == "nativeCompSet" || + action == "nativeSonKuSet" || action == "nativeThrowSet" || action == "nativeThrowTrigger" || action == "nativeThrowTempoSource")) { @@ -4472,6 +4558,81 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr return; } + // 8D-SonKu typed settings; ordinary native FX lease and PCM mailbox. + if(action=="nativeSonKuSnapshot"||action=="nativeSonKuSet") { + const auto fxRequest=armix::builtin_fx::NativeFxControlRequest::parse( + args,LiveDryRoutingLab::maxFxPerLane); + const auto& rawChannel=fxRequest.rawChannel; + const auto& rawEpoch=fxRequest.rawEpoch; + const auto& rawRevision=fxRequest.rawRevision; + const auto& rawInstance=fxRequest.rawInstance; + const auto& request=fxRequest.request; + const int slot=fxRequest.slot; + const auto ch=fxRequest.channel,ep=fxRequest.epoch,rev=fxRequest.revision; + const bool valid=fxRequest.valid,unbound=fxRequest.unbound; + armix::session::StoredInsert offlineInsert; + auto offline=unbound?openLogicalBuiltinFx(args,offlineInsert, + armix::builtin_fx::SonKuSpatialProcessor::catalogIdentity):nullptr; + auto owner=valid&&!unbound?engine_.leaseNativeVst3Editor(ep,rev, + armix::mixer::ChannelId{ch},static_cast(slot), + rawInstance.toString()): + armix::mixer::LiveChannelFxGraph::InstanceLease{}; + auto* p=dynamic_cast( + unbound?offline.get():owner?owner->processor.get():nullptr); + if(action=="nativeSonKuSnapshot") { + emitNativeSonKuSnapshot(request,rawChannel.toString(), + rawEpoch.toString(),rawRevision.toString(),rawInstance.toString(),p); + return; + } + const auto values=args.getProperty("settings",{}); + armix::sonku::Settings settings{}; + auto number=[&values](const char* key,float& dest) { + const auto v=values.getProperty(key,{}); + if(!v.isDouble()&&!v.isInt())return false; + const double n=static_cast(v); + if(!std::isfinite(n) || n>1.0e6 || n< -1.0e6)return false; + dest=static_cast(n); + return std::isfinite(dest); + }; + const auto moving=values.getProperty("moving",{}); + const auto clockwise=values.getProperty("clockwise",{}); + const bool parameters=values.isObject() && + number("startAzimuthDegrees",settings.startAzimuthDegrees) && + number("revolutionSeconds",settings.revolutionSeconds) && + number("stereoSpreadDegrees",settings.stereoSpreadDegrees) && + number("spatialMix",settings.spatialMix) && + number("outputTrim",settings.outputTrim) && + moving.isBool()&&clockwise.isBool(); + if(parameters){settings.moving=static_cast(moving); + settings.clockwise=static_cast(clockwise);} + const auto numeric=fxRequest.sequence("sonku-"); + bool queued=false; + if(p&&numeric&¶meters&&armix::sonku::valid(settings) && + !pendingNativeSonKu_.owner&&!nativeShowBusy_&&!studioBackupBusy_&& + !engine_.independentClockActive()) { + queued=p->queueSettings(settings,numeric); + if(queued&&!unbound) { + pendingNativeSonKu_.owner=owner; + pendingNativeSonKu_.request=request; + pendingNativeSonKu_.channelId=rawChannel.toString(); + pendingNativeSonKu_.deviceEpoch=rawEpoch.toString(); + pendingNativeSonKu_.revision=rawRevision.toString(); + pendingNativeSonKu_.instanceId=rawInstance.toString(); + pendingNativeSonKu_.started=juce::Time::getMillisecondCounter(); + } + } + if(unbound)return completeLogicalFxEdit(args,std::move(offlineInsert), + p,queued,"arMixBuiltinSonKuAck"); + auto ack=std::make_unique(); + ack->setProperty("requestId",request); + ack->setProperty("status",queued?"QUEUED":"REJECTED"); + ack->setProperty("errorCode",queued?"NONE": + pendingNativeSonKu_.owner?"SONKU_CONTROL_BUSY":"INVALID_OR_STALE_SONKU"); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixBuiltinSonKuQueue",juce::var(ack.release())); + return; + } + // ArSon Vocal Throw: all UI commands reference one exact installed // ChannelId + device epoch + graph revision + insert instance. if(action=="nativeThrowSnapshot"||action=="nativeThrowSet"|| @@ -6681,6 +6842,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr serviceNativeMusicTempo(); servicePendingNativeEq(); servicePendingNativeComp(); + servicePendingNativeSonKu(); servicePendingNativeHarmony(); servicePendingNativeThrow(); saveClosedLogicalVendorEditor(); diff --git a/src/NativeBuiltInFx.h b/src/NativeBuiltInFx.h index a2c1a8092..6bd9ba6d1 100644 --- a/src/NativeBuiltInFx.h +++ b/src/NativeBuiltInFx.h @@ -5,6 +5,7 @@ #include "../engine/builtin_fx/ChannelCompressorProcessor.h" #include "../engine/builtin_fx/ChannelHarmonyProcessor.h" #include "../engine/builtin_fx/VocalThrowProcessor.h" +#include "../engine/builtin_fx/SonKuSpatialProcessor.h" #include "../engine/core/PreparedMixerBlock.h" #include #include @@ -75,7 +76,12 @@ inline constexpr std::array nativeBuiltInFx{ "NATIVE_THROW_HOST_UNAVAILABLE","NATIVE_THROW_DEVICE_CHANGED", "NATIVE_THROW_UNSUPPORTED_AUDIO_FORMAT","NATIVE_THROW_PREPARE_REJECTED", "NATIVE_THROW_PREPARE_EXCEPTION","Saved native Vocal Throw state rejected; graph unchanged", - prepareNativeBuiltInFx} + prepareNativeBuiltInFx}, + NativeBuiltInFx{SonKuSpatialProcessor::catalogIdentity,"8D-SonKu","Spatial",true,44100.,48000., + "NATIVE_SONKU_HOST_UNAVAILABLE","NATIVE_SONKU_DEVICE_CHANGED", + "NATIVE_SONKU_UNSUPPORTED_AUDIO_FORMAT","NATIVE_SONKU_PREPARE_REJECTED", + "NATIVE_SONKU_PREPARE_EXCEPTION","Saved 8D-SonKu state rejected; graph unchanged", + prepareNativeBuiltInFx} }; // Compile-time registration contract: one stable catalog identity per FX, diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 9d9e444ee..073beca3c 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -80,7 +80,16 @@ test('JUCE embeds only generated approved Pages DOM, CSS, JS, and PNG button var assert.match(nativeMain,/withResourceProvider \(assetFor\)/); assert.match(generator,/approvedPagesHtmlSha256/); assert.match(generator,/authoritativePagesOutput/); - assert.match(read('scripts/build_pages.py'),/mute-solo-pfl-56x37\.png/); + // The approved PNG button sprite was updated after this historic FAT + // assertion. Verify the CURRENT production asset, source ownership and + // fail-closed copy path instead of pinning a retired image filename. + const pages=read('scripts/build_pages.py'); + const sprite=pages.match(/sprite='([^']+\.png)'/)?.[1]; + assert.equal(sprite,'harmonice-thin-flat-v8-57x30.png'); + assert.ok(readFileSync('site/preview-buttons/assets/'+sprite).byteLength>500); + assert.match(pages,/for name in \(\*special,sprite\):/); + assert.match(pages,/src=buttons_source\/name/); + assert.match(pages,/Approved PNG asset missing:/); }); test('independent release gate rejects old self-consistent web hash artifact',()=>{ diff --git a/tests/native_peq_assembly_test.py b/tests/native_peq_assembly_test.py index 069bd4889..1c1fef948 100644 --- a/tests/native_peq_assembly_test.py +++ b/tests/native_peq_assembly_test.py @@ -27,6 +27,9 @@ def test_one_authoritative_mixer(self): self.assertEqual(self.assembled.count("function insertChosenNativeThrow(){"),1) self.assertEqual(self.assembled.count('src="assets/mixer-native-vocal-throw.js?v=throw-1"'),1) self.assertEqual(self.assembled.count('data-fast-native-throw="1"'),1) + self.assertEqual(self.assembled.count('data-fast-native-sonku="1"'),1) + self.assertEqual(self.assembled.count('src="assets/mixer-native-sonku.js?v=sonku-1"'),1) + self.assertEqual(self.assembled.count("function insertChosenNativeSonKu(){"),1) def test_native_rack_uses_regular_insert_slot(self): self.assertIn("host.insert(activeFxTarget)",self.assembled) @@ -46,6 +49,12 @@ def test_single_style_owner(self): self.assertNotIn('href="assets/mixer-native-peq.css',self.assembled) css=(ROOT/"site/preview-v2/assets/mixer-fx-rack.css").read_text("utf-8") self.assertIn(".mx-peq[hidden]{display:none}",css) + self.assertIn(".mx-sonku[hidden]{display:none!important}",css) + self.assertNotIn("mixer-native-sonku.css",self.assembled) + sonku=(ROOT/"site/preview-v2/assets/mixer-native-sonku.js").read_text("utf-8") + self.assertIn('arMixBuiltinSonKuAck',sonku) + self.assertIn('nativeSonKuSet',sonku) + self.assertNotIn("new AudioContext",sonku) self.assertIn("grid-template-columns:minmax(0,1fr) 143px",css) script=(ROOT/"site/preview-v2/assets/mixer-native-peq.js").read_text("utf-8") self.assertIn('const LOG=Math.log(1000)',script) diff --git a/tests/pages_contextual_buttons_smoke.py b/tests/pages_contextual_buttons_smoke.py index 09d0b38b4..b1edcf891 100644 --- a/tests/pages_contextual_buttons_smoke.py +++ b/tests/pages_contextual_buttons_smoke.py @@ -35,9 +35,13 @@ def check_page(browser,path,label): assert not legacy.evaluate("""e=>{ return e.matches('.command-bar button.tool,.console-body .strip button.mx-util-key'); }"""),label - # Compare the non-audio action at rest, held down and released. - action=page.locator('#clearCue') - assert action.is_visible(),(label,'clearCue hidden') + # CLEAR CUE was retired from the approved GUI. Do not revive a + # disabled/hidden PFL control merely to satisfy this historic material test. + assert page.locator('#clearCue').is_hidden(),(label,'retired PFL button reappeared') + # Use the real current momentary Save Scene action instead; it is + # visible and preserves the same pressed/released material contract. + action=page.locator('#saveScene') + assert action.is_visible(),(label,'Save Scene hidden') before=css_for(action) assert 'gradient' in before['background'],(label,before) position=page.evaluate("""()=>({ diff --git a/tests/sonku_spatial_core_test.cpp b/tests/sonku_spatial_core_test.cpp new file mode 100644 index 000000000..31c9ad70c --- /dev/null +++ b/tests/sonku_spatial_core_test.cpp @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#if defined(NDEBUG) +#undef NDEBUG +#endif +#include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include +#include +#include +#include + +int main() { + using namespace armix::sonku; + SonKuSpatialCore rejected; + assert(!rejected.prepare(96000.)); + assert(!rejected.prepare(std::numeric_limits::infinity())); + assert(!rejected.ready()); + for(double rate:{44100.,48000.}) { + SonKuSpatialCore core; + assert(core.prepare(rate)); + Settings s{}; + s.moving=false; s.stereoSpreadDegrees=0.f; s.spatialMix=1.f; + s.outputTrim=0.8f; + assert(core.setSettings(s)); + constexpr int frames=512; + std::array frontL{},frontR{},rearL{},rearR{},rightL{},rightR{}; + auto impulse=[&](float angle,std::array& a,std::array& b) { + core.reset();Settings pos=s;pos.startAzimuthDegrees=angle; + assert(core.setSettings(pos)); + a.fill(0.f);b.fill(0.f);a[0]=1.f; + core.process(a.data(),b.data(),frames); + }; + impulse(0.f,frontL,frontR); + impulse(180.f,rearL,rearR); + impulse(90.f,rightL,rightR); + double front=0.,rear=0.,right=0.,difference=0.; + for(int i=0;i.01&&rear>.01&&right>.01&&difference>.01); + double lrDelta=0.; + for(int i=0;i.01); // genuine differing HRIR ear filters + // MIT KEMAR +90 degrees is RIGHT, not left: the physical right-ear + // measured impulse arrives earlier and carries substantially more + // early energy. This catches coordinate/ear-swapping mistakes. + double earlyLeft=0.,earlyRight=0.; + for(int i=0;i<32;++i) { + earlyLeft+=rightL[i]*rightL[i]; + earlyRight+=rightR[i]*rightR[i]; + } + assert(earlyRight>earlyLeft*4.); + Settings moving{}; + moving.revolutionSeconds=0.5f; + moving.stereoSpreadDegrees=50.f; + moving.outputTrim=0.5f; + assert(core.setSettings(moving)); + assert(!core.setSettings(Settings{0.f,0.f,60.f,1.f,0.5f,true,true})); + constexpr int longFrames=1024; + std::array oneL{},oneR{},chunkL{},chunkR{}; + for(int i=0;i dryL{},dryR{};dryL.fill(.17f);dryR.fill(-.29f); + chunked.process(dryL.data(),dryR.data(),32); + for(int i=0;i<32;++i){assert(std::abs(dryL[i]-.17f)<1.e-6f);assert(std::abs(dryR[i]+.29f)<1.e-6f);} + } + return 0; +}