3D Audio Room Simulator with Distance-Based Panning — User Guide
Moves a mono source along a bounded 3D trajectory inside a rectangular room and projects the result to two-channel loudspeaker stereo using either a shared room response or position-dependent image-source responses.
What this does
3D Audio Room Simulator places a stationary listener at the centre of a rectangular room and moves the source along one of eight trajectories. The source is divided into overlapping time blocks. Each block is spatialized at the corresponding trajectory position, room-processed, and accumulated into a stereo output.
The source position has x, y, and z coordinates, and all three coordinates affect distance and the room/image-source geometry. The output, however, is ordinary two-channel loudspeaker stereo. There is no HRTF, head model, binaural rendering, or explicit elevation cue. Vertical movement can change distance, delay, level, and reflection geometry, but height is not encoded as a binaural elevation percept.
The two room modes are deliberately different:
- Shared room IR: one mono room impulse response is used for the whole run. Position changes only source level and stereo balance before the common room response is placed into the output.
- Per-position image-source IR: each source position gets its own left and right impulse responses. Direct sound and first/second-order axial image sources are recomputed from that position, and every reflection is panned from its own image-source direction. A decorrelated diffuse tail is added to both channels.
Quick start
- Select exactly one Sound in Praat.
- Run
3D Audio Room Simulator with Distance-Based Panning.praat. - Choose a room preset or Custom.
- Choose one of the eight movement trajectories and set Movement_radius and Num_positions.
- Choose Shared room IR or Per-position image-source IR.
- For the per-position model, choose whether the complete response is shifted by physical propagation delay
d/c. - Set Ir_padding, Crossfade_time, and DBAP or equal-power stereo panning.
Draw_visualization or Play_result controls in v0.6.1.
Geometry and movement
Coordinate convention
The same convention is used by the trajectory generator, panning equations, image-source geometry, and visualization.
Movement trajectories
| Movement | Implemented path |
|---|---|
| Circular | Horizontal circle: x=r cos(a), y=r sin(a). |
| Front to Back | One-way sweep on y, from +r (front) to -r (back). |
| Left to Right | One-way sweep on x, from -r to +r. |
| Spiral | Three-turn horizontal spiral whose radius grows from 0 to r. |
| Up and Down | Vertical sinusoid on z, reaching ±r. |
| Random walk | Deterministic two-axis wander. It contains no random draw and therefore needs no seed. |
| Figure-8 | Gerono lemniscate: x=r sin(a), y=(r/2) sin(2a). |
| Diagonal sweep | One-way diagonal with x=y, normalized so the corner distance reaches r. |
Radius enforcement
Movement_radius means the maximum source-listener distance for the selected trajectory. The script computes a trajectory-specific admissible radius from the room dimensions and clamps the requested radius to 95% of that limit when necessary. The Info window reports any clamp.
Room model
Sabine RT60 and wall reflection
Custom absorption is clamped to 0.01–1.0. Computed RT60 is then clamped to 0.05–5.0 s.
Critical distance
In the per-position model, this value calibrates the diffuse-tail energy against the direct field. The calibration is specifically direct versus diffuse tail; early reflections add additional non-direct energy.
Shared room IR
The shared mode builds one mono IR at the room centre. It contains a direct tap, first- and second-order axial reflections, and a deterministic diffuse tail. Each moving source segment is first attenuated by the softened amplitude law:
The segment is then convolved with that same room IR and projected into stereo using the source position. In this mode, movement does not change reflection times or reflection directions.
Per-position image-source IR
For each source position, the script creates separate left and right IRs. The direct sound and axial image sources of orders 1 and 2 are placed according to the rectangular-room image-source geometry. Reflection amplitude is |R|^order / distance, and each image source receives its own DBAP or equal-power stereo gains before its tap is written.
The direct amplitude follows 1/d, with source-listener distance floored at 0.3 m to avoid an unbounded gain when a trajectory passes through the listener.
Diffuse tail
The diffuse component uses two deterministic, decorrelated hash-noise sequences for left and right. Its envelope is:
The tail amplitude is calibrated from the closed-form energy of that complete envelope so that the diffuse field matches the direct field at d_crit. Because the early field is additional, d_crit is not the crossover between direct sound and the total reverberant response.
Propagation delay
With Propagation_delay enabled in the per-position model, the entire response for each segment — direct sound, early reflections, and diffuse tail — is shifted by d/c with c = 343 m/s. This keeps the response causal at each source position. The shared-IR mode does not use this per-position propagation delay.
IR padding
Ir_padding adds time after the RT60-based diffuse decay when sizing the IR. It does not change the RT60 itself.
Stereo panning
Speaker geometry
The listener is at the origin. The stereo speakers lie on the x axis. Their nominal positions are ±1 m, but each is clamped to 90% of the room half-length so the speakers remain inside narrow rooms.
DBAP
The gains satisfy gL² + gR² = 1. With the square-root normalization, the underlying amplitude rolloff is approximately 1/d, or about 6 dB per doubling of distance. This is stereo distance-based amplitude panning; it should not be confused with binaural localization.
Equal-power alternative
With DBAP off, the script maps the source/image x coordinate into the room's left-right span and applies ordinary equal-power stereo:
Segment rendering
The source is divided into Num_positions equally spaced hops:
Adjacent source segments overlap by exactly Crossfade_time. Linear fade-out/fade-in windows are used so the overlap reconstructs continuously when Crossfade_time ≤ block_duration. The script stops with an explicit error if the requested crossfade is longer than one hop.
Each windowed segment is processed at one trajectory position and written to its corresponding output time. In per-position mode, optional propagation delay is added to that write position. The stereo buffers are finally combined and peak-scaled to 0.99.
Room presets
| Preset | Length × Width × Height | Absorption |
|---|---|---|
| Custom | Form values | Form value, clamped to 0.01–1.0 |
| Small Studio | 4 × 3 × 2.5 m | 0.60 |
| Living Room | 6 × 5 × 3 m | 0.40 |
| Concert Hall | 20 × 15 × 8 m | 0.15 |
| Cathedral | 40 × 25 × 15 m | 0.08 |
| Bathroom | 2.5 × 2 × 2.5 m | 0.05 |
| Anechoic Chamber | 5 × 5 × 3 m | 0.99 |
| Club/Bar | 15 × 10 × 3.5 m | 0.25 |
RT60 is calculated from these values at run time rather than stored as a preset constant, and is limited to the 0.05–5.0 s range.
Parameters
| Parameter | Default | Behaviour |
|---|---|---|
| Preset | Custom | Custom plus seven room presets. |
| Custom_length | 8.0 m | Left-right room dimension; used only for Custom. |
| Custom_width | 6.0 m | Back-front room dimension; used only for Custom. |
| Custom_height | 3.0 m | Down-up room dimension; used only for Custom. |
| Custom_absorption | 0.3 | Energy absorption coefficient; clamped to 0.01–1.0. |
| Movement | Circular | Eight trajectories listed above. |
| Movement_radius | 2.5 m | Requested maximum distance from listener; may be reduced to keep the complete path inside the room. |
| Num_positions | 16 | Number of source positions/time blocks; enforced minimum is 2. |
| Ir_model | Per-position image-source IR | Shared room IR or position-dependent stereo image-source responses. |
| Propagation_delay | on | Per-position mode only: shifts the entire response by source distance / 343. |
| Ir_padding | 0.3 s | Extra IR duration after the RT60-based decay. |
| Crossfade_time | 0.1 s | Overlap between adjacent source blocks; must not exceed source_duration / Num_positions. |
| Use_dbap | on | DBAP if on; x-based equal-power stereo if off. |
Visualization
The visualization is always drawn in v0.6.1 and is a direct process view rather than an explanatory diagram.
- Room top view: x-y room rectangle, metre grid, listener, stereo speakers, continuous movement curve, and the actual sampled source positions. The path uses the same trajectory procedure and parameter domain as the audio renderer.
- Elevation: z coordinate versus position index, with floor and ceiling shown. The panel explicitly notes that elevation is not encoded as an HRTF cue in the stereo output.
- Stereo output waveform: left channel in blue and right channel in orange on one measured amplitude scale.
- Summary: room dimensions, volume, absorption, pressure reflection coefficient, RT60, critical distance, movement/radius, position count, hop/crossfade, panning mode, IR model, and IR padding.
The top-view path is blue at its start and red at its end; the sampled position markers use the same progression.
Output and limits
- Output: two-channel Sound named
<source>_spatial_stereo. - Final level: peak-scaled to 0.99.
- Tail: output duration extends beyond the source to accommodate crossfade, early/diffuse response, optional propagation delay, and additional safety time.
- Input time domain: if the selected Sound does not start at 0, the script makes an internal zero-based copy before segmentation.
- Multichannel input: more than one input channel is averaged to mono before room processing. The current script does not perform cancellation-safe channel selection for anti-phase material.
- Randomness: the diffuse tail and “Random walk” are deterministic. No random seed is exposed or required for reproducibility.
- Room scope: only axial first- and second-order image sources are modeled in the per-position early field; this is not a complete high-order room-acoustics simulation.
- Spatial scope: the model does not include HRTFs, listener rotation, head shadow, interaural time differences, or a dedicated elevation renderer.