Files
FluidSimCpp/verification/AUDIO_RENDERING.md
2026-10-23 18:29:51 +02:00

113 lines
6.3 KiB
Markdown

# Audio rendering notes
The desktop and capture tool produce sound at 44.1 kHz. Intake and exhaust
ambient-density-scaled volume-flow derivatives drive the compact-monopole source, with static
source/listener positions, fractional-sample propagation, inverse-distance
spreading, and separate left/right ear paths. The monitor uses a second-
order 6 kHz low-pass; desktop playback removes DC and applies PCM clipping
protection.
## Outdoor scenes
`OutdoorAudio` renders direct sound, image-source ground and wall reflections,
and six approximate woodland scatter paths. The tunnel profile adds image
paths for a nominally 6 m wide, 4 m high hard-surface enclosure. Its late tail
uses the live eight-line feedback-delay network in `OutdoorExhaustReverb`. The
five scene profiles set different reflection paths, tail levels, and
frequency-dependent decay times. Scene changes smooth over 20 ms. These
profiles are intended for listening comparisons, not as validated models of
particular locations.
The direct source remains prominent, so scene differences are clearest in the
reflections and decay after transients. Ground effects depend on surface,
geometry, and frequency; the current coefficients are illustrative settings,
not measured material data. The feedback-delay network gives a diffuse late
tail, but does not simulate outdoor wave propagation or vegetation in detail.
Calibrated directivity, alias-free acquisition,
and exhaust afterfire chemistry remain unresolved. Filtering cannot restore
source information lost to aliasing. Mechanical sound synthesis has been
removed; no mechanical source is currently rendered.
## Listening and capture
Run the desktop with `--scenario v8 --scene tunnel` and press **R** to cycle
through Dry, Field, Wall, Woodland, and Tunnel. Use 1x playback when judging
the audio.
To write comparable WAVs for one scene, build and run:
```sh
cmake --build build-desktop --target fluidsim_audio_capture -j 4
./build-desktop/fluidsim_audio_capture --scenario v8 --scene field --seconds 1 --throttle .7 --out /tmp/v8-field
```
The capture tool writes rendered, dry-filtered, and unfiltered WAV files. The
dry and unfiltered outputs omit the outdoor reflections and reverb, which helps
separate source filtering from scene processing.
## Reference basis
- [FHWA ground-effect guidance](https://www.fhwa.dot.gov/Environment/noise/noise_barriers/design_construction/design/design03.cfm)
- [Feedback delay networks in artificial reverberation](https://theses.eurasip.org/document/feedback-delay-networks-in-artificial-reverberation-and-reverberation-enhancement/)
## Pipe mouth boundary
All scenario pipe mouths use `add_radiating_open_end`. The intake atmosphere
component/orifice has been replaced by the same boundary used at exhaust mouths.
Physical intake plenums and exhaust collectors remain finite storage volumes.
The older `add_open_end` pressure-release boundary remains for idealized tests.
The unflanged circular-mouth reflection follows the causal second-order rational
fit in Silva et al., Eq. 16, with the low-frequency constraints in Eq. 17.
Its pressure reflection tends to -1 at low frequency, includes the 0.6133-radius
end correction, and loses reflected energy as frequency rises. Two scalar states
are integrated with the trapezoidal rule at each actual CFL substep; no history
buffers or allocations are needed. The filtered incoming characteristic combines
with the outgoing duct characteristic to determine the face state. One face flux
updates the pipe. The same face velocity and area supply the audio volume-flow
source, scaled by ambient density. Ambient inflow carries
fresh air, zero fuel, and 300 K stagnation enthalpy.
This is a plane-wave, no-flow radiation approximation coupled to a nonlinear
Euler duct. It does not establish accurate hot-jet/high-Mach radiation, vortex
shedding, flange effects, or higher duct modes. The published continuous model
has errors below 8 percent for reflection magnitude/end correction at ka <= 2;
mesh damping and time discretization introduce additional simulation error.
The audio renderer still uses a compact monopole approximation, so this boundary
upgrade alone does not calibrate external SPL or directivity.
Source: [Silva et al., acoustic radiation impedance](https://arxiv.org/html/0811.3625).
Recorded Linux Release check after this change: all seven CTest suites passed
(27.83 s). Tests cover the reflection fit's amplitude and phase at ka=0.1, 0.5,
1 and 2, inverted returning pulses at both orientations, reported mass exchange,
and fresh-air inflow stagnation enthalpy. These are implementation checks, not
experimental validation of strong-flow radiation. The B205 regression now checks
only its four active cylinders instead of the unused slots added for the V8.
A four-second V8 4500-RPM loaded benchmark took 0.395, 0.387, 0.403 and 0.403
wall seconds per simulated second (mean 0.397). This is headless runtime evidence
on this machine, not a measurement of audio device underruns. A four-second
V8/tunnel capture at 50 percent pedal had rendered peak 0.1011, RMS 0.02027,
and zero clipped samples. Capture files are under `build-desktop/audio/open-end-v8-*`.
## Light-load mouth-source correction
The radiating mouth previously sent actual mass flow to the sound renderer.
Switching between hot exhaust and cool ambient inflow introduces a donor-density
change into that signal. The renderer now differentiates ambient-density-scaled
volume flow, following the compact monopole formulation in the
[openCFS acoustic documentation](https://opencfs.gitlab.io/userdocu/PDEExplanations/Singlefield/AcousticPDE/).
Physical mass and energy fluxes and the causal reflection model are unchanged.
This remains a compact, no-mean-flow acoustic approximation.
A prescribed 4500 RPM Saab run, with one second of warmup and two seconds of
capture, compared the same straight-through exhaust before and after this audio
change. At 5% pedal, rendered RMS changed from 0.022763 to 0.024120; the fraction
of power above 2 kHz fell from 0.0475% to 0.0003%. At 15% pedal, maximum sample
change divided by RMS fell from 0.607 to 0.086. These are signal measurements,
not confirmation of perceived realism or a complete road-transient validation.
A regression checks that prescribed mouth velocity produces the same acoustic
volume source at hot and ambient donor densities, in both pipe orientations.