Spectral Panning Mapper — User Guide

Spectral-driven dynamic spatial panning for 2–8 output channels. Spectral flatness controls orbit radius; frame-to-frame spectral flux controls orbit speed; a 2D DBAP stage converts the moving source position into per-channel gain envelopes.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.1.4 (2026) Technique: Spectral Features → Orbit → DBAP Category: Spatial / Composition License: MIT License Repo: Praat AudioTools
Contents:

What this does

The script converts the selected Sound to a mono analysis/rendering source, measures two spectral descriptors in the 80–8000 Hz band, and uses them to drive a moving point in a two-dimensional loudspeaker space.

v1.1.4 correction: spectral flux is now a true frame-to-frame descriptor. The script compares consecutive L2-normalized magnitude spectra rather than measuring variation between neighbouring frequency bins inside one spectrum. Per-channel DBAP gains are also applied without independent channel normalization, so the spatial gain ratios survive rendering.

Quick start

  1. Select exactly one Sound in Praat. Minimum duration is 0.3 s.
  2. Run Spectral_Panning_Mapper.praat.
  3. Choose a named preset, or use Custom/Custom Multi for the form values and a regular-ring layout.
  4. For Custom operation, set Num_channels (2–8), the analysis/update controls, orbit controls, DBAP rolloff, and wet/dry mix.
  5. Keep Draw_visualization enabled if you want the feature/orbit/gain diagnostic.
  6. Click OK. The result is named source_SPM_preset and remains selected; it is played if Play_result is enabled.
Preset behaviour: named presets overwrite channel count, speaker positions, radius/speed controls and DBAP rolloff. Analysis_windows, Panning_update_rate_Hz, Mix_percent, visualization and playback remain global form controls.

Spectral features

Spectral flatness (Wiener entropy)

flatness = geometric_mean(power) / arithmetic_mean(power) power[k] = magnitude[k]^2 analysis band = 80–8000 Hz output is clamped to [0, 1]

Each analysis frame is extracted with a Hamming window. Flatness approaches 0 when energy is concentrated in relatively few bins and approaches 1 when power is distributed more evenly across the analysed band. The script maps this value to orbit radius.

Frame-to-frame spectral flux

For each frame: m = magnitude vector in 80–8000 Hz m_norm = m / ||m||₂ For frames t-1 and t: flux = sqrt( Σ (m_norm[t,k] - m_norm[t-1,k])² / 2 ) flux is clamped to [0, 1] first analysis frame = 0

Because each magnitude vector is L2-normalized before comparison, this descriptor primarily reflects spectral-shape change rather than a simple change in overall level. The factor of 2 normalizes the maximum squared distance of non-negative unit vectors to a 0–1 scale.

Analysis timing: the default is 10 analysis windows. The half-window starts at 100 ms, is reduced when necessary relative to file duration/window count, and is never allowed below 20 ms. Feature values measured at those analysis times are linearly interpolated onto the panning update grid.

Orbit & DBAP mapping

Orbit model

Moving source position

orbitRadius = Base_orbit_radius + flatness × Flatness_radius_influence orbitRadius = min(orbitRadius, 0.95) orbitSpeed = Base_orbit_speed_Hz + flux × Flux_speed_influence angle += 2π × orbitSpeed × Δt srcX = orbitRadius × cos(angle) srcY = orbitRadius × sin(angle)

Flatness therefore changes how far the source travels from the centre, while flux changes how quickly the angular trajectory advances.

DBAP gain calculation

Distance-based gains

distance_i = sqrt((srcX - speakerX_i)^2 + (srcY - speakerY_i)^2) distance_i = max(distance_i, 0.01) rawGain_i = 1 / distance_i ^ Rolloff_exponent norm = sqrt(Σ rawGain_i²) gain_i = rawGain_i / norm

The normalization makes Σ gaini² = 1 across the active full-range channels at each control point. This is a gain-law property; it should not be interpreted as a guarantee of constant perceived loudness in an arbitrary room or loudspeaker array.

Gains are stored in IntensityTiers in dB with a numerical floor of −120 dB. They are then multiplied into channel copies with Multiply: "no", explicitly avoiding Praat's per-result rescaling so that the DBAP ratios are preserved.

Presets & speaker layouts

The menu contains 12 named spatial presets plus Custom and Custom Multi. The two Custom choices are functionally equivalent in v1.1.4: both use the form values and create a regular ring with Num_channels speakers.

PresetChannels / layoutRadiusSpeedRolloff
Stereo Sweep2, L/R at (−1,0)/(+1,0)0.50 + flatness×0.500.50 + flux×3.0 Hz1.0
Stereo Drift2, L/R0.20 + flatness×0.300.15 + flux×1.0 Hz1.0
Triangle Orbit3, regular triangle0.40 + flatness×0.500.30 + flux×2.0 Hz1.0
Quad Spiral4, square rotated 45°0.30 + flatness×0.600.40 + flux×3.0 Hz1.0
Quad Corners4, square rotated 45°0.10 + flatness×0.850.20 + flux×1.5 Hz1.2
Hex Ring6, regular hexagon0.30 + flatness×0.550.35 + flux×2.5 Hz1.0
Surround 5.16: L/R ±30°, C 0°, LFE Ch4, surrounds nominally ±110°0.00 + flatness×0.600.30 + flux×2.0 Hz1.0
Octagon Orbit8, regular ring0.35 + flatness×0.550.30 + flux×2.0 Hz1.0
Octagon Front Arc8, front semicircle at radius 0.90.40 + flatness×0.400.25 + flux×2.5 Hz1.0
Diffuse Field8, regular ring0.05 + flatness×0.900.10 + flux×0.5 Hz0.8
Hyperactive4, square rotated 45°0.20 + flatness×0.701.20 + flux×8.0 Hz1.0
Slow Evolution6, regular hexagon0.25 + flatness×0.400.08 + flux×0.4 Hz1.0
5.1 LFE policy: Channel 4 is reserved as LFE but remains silent. It is excluded from DBAP power normalization, wet rendering, dry distribution and the heatmap's active-gain calculation. The script deliberately does not invent a crossover or bass-management stage.

Parameters & controls

ControlDefaultBehaviour
PresetStereo DriftChooses one of 12 named presets or either Custom entry.
Num_channels4Custom only. Clamped to 2–8 before the regular-ring speaker coordinates are built.
Analysis_windows10Integer number of spectral analysis frames. Must be at least 2; otherwise the script exits.
Panning_update_rate_Hz100Control-grid update rate used for interpolated features, orbit position and gain tiers.
Base_orbit_radius0.3Custom baseline radius; named presets override it.
Flatness_radius_influence0.6Custom scaling from flatness to radius; named presets override it.
Base_orbit_speed_Hz0.4Custom baseline angular speed; named presets override it.
Flux_speed_influence3.0Custom scaling from frame-to-frame flux to angular speed; named presets override it.
Rolloff_exponent1.0Exponent in the inverse-distance DBAP weight; named presets may override it.
Mix_percent100Linear wet/dry mix, clamped to 0–100.
Draw_visualizationOnDraws the 6 data panels plus title/subtitle and summary.
Play_resultOnPlays the selected multichannel result after processing.

Processing pipeline

  1. Input validation: exactly one Sound, duration ≥0.3 s; Custom channels are clamped to 2–8 and analysis windows must be ≥2.
  2. Mono working source: multichannel input is downmixed to mono; mono input is copied.
  3. Spectral analysis: Hamming-windowed spectra are measured in 80–8000 Hz. Flatness is calculated from power; flux compares the current normalized magnitude spectrum with the preceding one.
  4. Interpolation: the sparse feature values are linearly interpolated to the update-rate grid.
  5. Orbit: interpolated flatness sets radius and interpolated flux sets angular speed.
  6. DBAP: distance weights are calculated for each active speaker and normalized so their squared gains sum to 1. In the 5.1 preset, LFE is excluded.
  7. Per-channel render: dB IntensityTiers are applied with no independent result normalization; LFE is explicitly zeroed.
  8. Multichannel assembly: all rendered channels are combined into one N-channel Sound.
  9. Wet/dry: when dry is present, the mono working source is distributed equally in power across all active full-range output channels using gain 1/sqrt(Nactive); LFE remains silent. Wet and dry are then mixed linearly.
  10. Final peak scaling: every non-silent result is scaled to a peak of 0.95. This can attenuate or amplify the mix and therefore changes absolute level.
  11. Output: result is named source_SPM_preset, selected and optionally played.
Dry is not the original channel image. Because the spatial engine is point-source based and begins from a mono working signal, the dry component is also a centred mono bed distributed across the active output channels. At 0% wet, the output is therefore this multichannel mono bed, followed by the same peak-to-0.95 scaling.

Visualization & analysis

When enabled, v1.1.4 draws six data panels, plus title/subtitle and a compact summary:

  1. Source waveform — original selected Sound, using a shared display amplitude based on the input peak.
  2. Spectral features — orange flatness and teal frame-to-frame flux, with vertical markers at the analysis times.
  3. Speaker layout + orbit — 2D speaker geometry, unit-circle reference, listener, source start point and orbit trace. In 5.1, Ch4 is labelled as reserved/silent rather than drawn as an active speaker.
  4. Orbit X/Y over time — horizontal components of the moving source position.
  5. Gain per channel over time — 50-column heatmap recomputed with the same DBAP and LFE-exclusion rules as the audio renderer.
  6. Output waveform — the final N-channel result after wet/dry mixing and peak scaling.

The summary reports source, preset, channel count, number of analysis windows, orbit mapping values, rolloff, update rate, mix, grid-point count and output name.

Notes & limitations