Higher-Order Ambisonic (HOA) Encoder — User Guide
Spatial audio encoding: converts mono source into ambisonic B-format with 1st, 2nd, or 3rd order spherical harmonic decomposition. Supports 3D positioning (azimuth, elevation, distance) with visualization and distance attenuation.
What this does
This script encodes a mono sound source into ambisonic B-format — a full-sphere surround sound format based on spherical harmonics. Position source in 3D space (azimuth 0-360°, elevation -90° to +90°, distance in meters), choose ambisonic order (1st=4 channels, 2nd=9 channels, 3rd=16 channels), and script generates individual ambisonic channels (W, X, Y, Z...) with spherical harmonic weighting. Includes distance attenuation and top-down visualization. Output requires ambisonic decoder for playback on speakers or headphones.
Quick start
- Select one Sound object in Praat (mono or stereo — will convert to mono).
- Run script… → Load HOA Encoder script.
- Choose Position_preset (10 presets) or select "Custom" for manual positioning.
- If Custom: Set Azimuth (0-360°), Elevation (-90 to 90°), Distance (meters).
- Set Reference_distance (1.0m default) for distance attenuation calculation.
- Choose Ambisonic_order: 1st (4ch), 2nd (9ch), or 3rd (16ch).
- Enable Normalize_output and Show_visualization.
- Click OK — encoding instant, individual channels appear in Objects list, visualization in Picture window.
Ambisonic Theory
What are Ambisonics?
Spatial audio format based on spherical harmonics:
- Full-sphere surround: Captures 3D sound field (horizontal + vertical)
- Scene-based: Independent of playback speaker arrangement
- Scalable resolution: Higher orders = better spatial precision
- Decoder-based playback: Requires decoder to render to specific speaker setup
Ambisonic Orders
| Order | Channels | Resolution | Use Case |
|---|---|---|---|
| 1st order | 4 (W,X,Y,Z) | Low spatial resolution | Basic 3D audio, mobile, VR |
| 2nd order | 9 | Medium resolution | Better localization, planetariums |
| 3rd order | 16 | High resolution | Professional spatial audio, cinema |
Channel count formula: (order + 1)² channels
- 1st: (1+1)² = 4 channels
- 2nd: (2+1)² = 9 channels
- 3rd: (3+1)² = 16 channels
Coordinate System
Azimuth (Horizontal Angle)
Elevation (Vertical Angle)
Distance (Radial)
Position Presets
| Preset | Azimuth | Elevation | Distance | Description |
|---|---|---|---|---|
| Front center | 0° | 0° | 1.5m | Straight ahead, close |
| Front left | 315° | 0° | 2m | 45° left of center |
| Left | 270° | 0° | 2m | Directly left |
| Rear left | 225° | 0° | 3m | 45° behind, left |
| Rear center | 180° | 0° | 3m | Directly behind |
| Rear right | 135° | 0° | 3m | 45° behind, right |
| Right | 90° | 0° | 2m | Directly right |
| Front right | 45° | 0° | 2m | 45° right of center |
| Above | 0° | +90° | 2.5m | Directly overhead |
| Below | 0° | -90° | 2.5m | Directly underneath |
Ambisonic Channels
1st Order (4 Channels)
2nd Order (5 Additional Channels)
Adds channels V, T, R, S, U (channels 4-8)
- Higher spatial resolution
- Better localization accuracy
- More complex spherical harmonic functions
3rd Order (7 Additional Channels)
Adds channels Q, O, M, K, L, N, P (channels 9-15)
- Professional-grade spatial resolution
- Precise source localization
- Complex spherical harmonic decomposition
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| Position_preset | choice | Custom | 10 position presets or manual |
| Azimuth | real | 0° | Horizontal angle (0-360°) |
| Elevation | real | 0° | Vertical angle (-90° to +90°) |
| Distance | real | 1.0m | Radial distance from origin |
| Reference_distance | real | 1.0m | Distance for 0 dB attenuation |
| Ambisonic_order | choice | 1st order | Spatial resolution (1st/2nd/3rd) |
| Normalize_output | boolean | yes | Scale all channels to 0.99 peak |
| Show_visualization | boolean | yes | Draw top-down position diagram |
Output
Individual channel objects in Objects list:
- 1st order: W, X, Y, Z (4 Sound objects)
- 2nd order: + V, T, R, S, U (9 total)
- 3rd order: + Q, O, M, K, L, N, P (16 total)
Info window displays:
- Input sound info (mono conversion if needed)
- Distance attenuation calculation (gain in linear and dB)
- Channel encoding values
- Final position summary
Picture window (if visualization enabled):
- Top-down circular diagram (4m radius)
- Concentric distance circles (1m, 2m, 3m, 4m)
- Cardinal direction labels (Front, Back, Left, Right)
- Red arrow showing source position and distance
- Position text (azimuth, elevation, distance)
Typical Workflow
Step-by-step ambisonic production:
- Encode sources: Run script for each mono source at different positions
- Mix channels: Combine corresponding ambisonic channels (all W, all X, etc.)
- Export B-format: Create multi-channel file with channel order (W,X,Y,Z...)
- Decode: Use ambisonic decoder for target speaker configuration
- Playback: Render to specific setup (stereo, 5.1, binaural, dome, etc.)
- Mix: A_W + B_W → combined W channel
- Mix: A_X + B_X → combined X channel
- Mix: A_Y + B_Y → combined Y channel
- Mix: A_Z + B_Z → combined Z channel
- Result: Single 4-channel B-format with both sources
Applications
Immersive audio production:
- Virtual reality (VR) soundscapes
- 360° video audio
- Planetarium shows
- Immersive installations
Spatial composition:
- Acousmatic music with spatial trajectories
- Multi-speaker dome performances
- Experimental spatial audio art
Research:
- Psychoacoustic spatial perception studies
- 3D audio algorithm testing
- Spatial hearing experiments
Post-production:
- Film surround sound (beyond 5.1/7.1)
- Game audio (dynamic 3D positioning)
- Broadcast spatial audio
Technical Notes
Spherical Harmonic Functions
Ambisonic encoding uses orthogonal spherical harmonics:
- Mathematical basis: Spherical Harmonics Ylm(θ,φ)
- Order (l): 1, 2, 3... determines spatial resolution
- Degree (m): -l to +l determines directional pattern
- Normalization: N3D (orthonormal) used in this script
Distance Attenuation
Normalization Schemes
This script uses N3D (Schmidt semi-normalized):
- Standard for modern ambisonics
- Used by: IEM, Ambix, Facebook 360, YouTube spatial
- Alternative: SN3D, FuMa (older formats)
Limitations
- Mono input only: Stereo automatically converted to mono
- Static positioning: No motion/trajectory support (encode multiple times for animation)
- No near-field compensation: Distance affects amplitude only, not frequency
- Decoder required: Cannot play B-format directly on standard speakers
- No Doppler effect: Moving sources need external processing
- Single source per run: Mix multiple encoded sources for complex scenes
Further Resources
Ambisonic decoders:
- IEM Plug-in Suite (free, comprehensive)
- Ambix (free, open-source)
- Reaper ReaPlugs (free, includes ambisonic tools)
- Blue Ripple Sound O3A (commercial)
Learning resources:
- Ambisonics.net — Tutorial and specifications
- York University Ambisonic Toolkit
- IEM documentation and video tutorials