← back view thesis

Sunset Sonata — Mapping Manual

Overview

Sunset Sonata maps atmospheric scattering parameters to both visual rendering and sound synthesis. Each physical property of the atmosphere controls specific aspects of the sunset visualization and the generated ambient music in real-time.

Visual Mapping

Atmospheric Scattering Model

The visual rendering uses a WebGL shader implementing atmospheric scattering physics. The Henyey–Greenstein phase function models how light scatters off particles in the atmosphere, creating the characteristic sunset colors.

Particle Density

Range: 0.1 - 5.0
Default: 1.0

Controls the number of particles per unit volume in the atmosphere. Higher density increases the amount of light scattering, making the sky more vibrant and the colors more saturated. This directly affects the optical depth calculation in the scattering equation.

→ Visual: Scattering intensity, color saturation

Particle Size Mean

Range: 0.01 - 2.0
Default: 0.5

The average size of atmospheric particles. Smaller particles scatter blue light more (Rayleigh scattering), while larger particles scatter all wavelengths more uniformly (Mie scattering). This parameter controls the asymmetry parameter (g) in the Henyey–Greenstein phase function.

→ Visual: Color temperature, blue vs red dominance

Particle Size Distribution (Spread)

Range: 0.1 - 3.0
Default: 1.0

The variance in particle sizes. A wider distribution creates more complex scattering patterns and smoother color transitions across the sky.

→ Visual: Color gradient smoothness

Optical Thickness

Range: 0.1 - 10.0
Default: 2.0

Measures how much light is absorbed or scattered as it passes through the atmosphere. Higher values create deeper, more intense sunsets with stronger color separation. The optical depth is calculated as: opticalDepth = thickness × density

→ Visual: Sunset intensity, color depth, horizon glow

Spectral LUT (Color Data)

Red Intensity: 0.0 - 2.0
Green Intensity: 0.0 - 2.0
Blue Intensity: 0.0 - 2.0

A lookup table controlling the spectral response of each color channel. This allows direct manipulation of the RGB color balance in the rendered sky. The values are multiplied with the computed scattering colors.

→ Visual: RGB color balance, spectral tinting

Sun Position

Elevation: -10° to 90°
Azimuth: 0° to 360°

The angular position of the sun in the sky. Elevation controls how high the sun is above the horizon (negative values place it below, creating sunset/dusk effects). Azimuth controls the compass direction. The sun's position determines the scattering angle and affects the phase function calculation.

→ Visual: Sun position, light direction, shadow placement

Geographic Parameters

Latitude: -90 to 90
Longitude: -180 to 180

Geographic coordinates that can be used to calculate accurate sun positions based on time and date (currently simplified in the demo).

Audio Mapping

Synthesis Architecture

The audio system uses Web Audio API to create an ambient synthesizer with multiple oscillators, filters, and effects. Each atmospheric parameter directly controls specific sound synthesis parameters in real-time, creating a sonic representation of the visual sunset. The system includes dynamic variations that simulate air movement and particle motion, making the sound less static and more organic. Wind-like amplitude modulations, random noise fluctuations, and oscillator detuning create a living, breathing soundscape that responds to atmospheric conditions.

Particle Density → Frequency Modulation & Wind Movement

Input Range: 0.1 - 5.0
Output: FM Rate 0.1 - 5.0 Hz, FM Depth 0.05 - 2.5
Output: Wind Rate 0.1 - 2.1 Hz, Wind Depth 0.05 - 0.2

Particle density controls multiple aspects of sound modulation. First, it controls the rate and depth of frequency modulation (FM) applied to all oscillators, creating pitch variations that simulate the dynamic movement of particles. Additionally, higher density creates more wind-like amplitude variations, simulating how particles blow and move through the air. The system uses multiple LFOs (Low Frequency Oscillators) to create complex, organic variations in both pitch and amplitude.

→ Audio: Pitch modulation, amplitude variations, wind-like oscillations
Formula: FM Rate = density × 1.0 Hz
Formula: FM Depth = density × 0.5
Formula: Wind Rate = 0.1 + (density / 5.0) × 2.0 Hz
Formula: Wind Depth = 0.05 + (density / 5.0) × 0.15
Modulation Sources: Primary wind LFO (sine), Secondary wind LFO (triangle, 2.3× faster)

Particle Size Distribution → Timbre & Variation Complexity

Size Mean Range: 0.01 - 2.0
Size Spread Range: 0.1 - 3.0
Output: Filter Cutoff 200 - 4000 Hz, Resonance 1.0 - 10.0
Output: Detune Amount 0 - 5 cents, Noise Amount 0 - 0.1

The particle size parameters control multiple aspects of sound generation. The mean size determines the filter cutoff frequency (higher = brighter), while the spread controls both the filter resonance/Q factor and the complexity of variations. Higher spread creates more varied particle sizes, which maps to increased detuning between oscillators (creating beating/chorus effects) and more random noise modulation (simulating the chaotic movement of differently-sized particles in the air). This creates a direct correlation between particle characteristics and both the brightness/texture and the organic, living quality of the sound.

→ Audio: Brightness, harmonic content, filter resonance, detuning, noise modulation
Formula: Cutoff = 200 + (sizeMean / 2.0) × 3800 Hz
Formula: Resonance = 1.0 + (sizeSpread / 3.0) × 9.0
Formula: Detune Amount = (sizeSpread / 3.0) × 5.0 cents
Formula: Noise Amount = (sizeSpread / 3.0) × 0.1
Effect: Random detuning per oscillator creates beating/chorus effects
Effect: Lowpass-filtered noise (2 Hz cutoff) creates smooth, wind-like random variations

Optical Thickness → Resonance Decay

Input Range: 0.1 - 10.0
Output: Reverb Decay Time 0.5 - 8.0 seconds

Optical thickness controls the decay time of the reverb/convolution effect. Thicker atmospheres create longer, more spacious reverb tails, simulating how light (and by analogy, sound) travels through dense atmospheric layers. The reverb impulse response is dynamically regenerated based on this parameter.

→ Audio: Reverb tail length, spatial depth, resonance decay
Formula: Decay Time = 0.5 + (thickness / 10.0) × 7.5 seconds

Spectral LUT (Color Data) → Harmonic Distribution & Pitch Mapping

Red: 0.0 - 2.0 → Fundamental & Low Harmonics (1st, 2nd, 3rd)
Green: 0.0 - 2.0 → Mid Harmonics (4th, 5th, 6th)
Blue: 0.0 - 2.0 → High Harmonics (7th, 8th, 9th)

Each color channel controls both the amplitude and the pitch of different harmonic partials in the synthesizer. The system uses 9 oscillators organized by color channel. Red controls the fundamental and lower harmonics (creating the bass foundation), green controls mid harmonics (body and warmth), and blue controls upper harmonics (brightness and texture). This creates a spectral mapping where the color balance directly affects both the harmonic content and the pitch range of the sound.

→ Audio: Harmonic spectrum, timbral balance, frequency content, pitch range

RGB → Pitch Frequency Mapping

Red Intensity: 0.0 - 2.0 → Pitch Range: 55 - 110 Hz (A1 to A2)
Green Intensity: 0.0 - 2.0 → Pitch Range: 110 - 220 Hz (A2 to A3)
Blue Intensity: 0.0 - 2.0 → Pitch Range: 220 - 440 Hz (A3 to A4)

Each RGB color channel controls a distinct pitch range. As you adjust the color intensity, the base pitch of that channel's oscillators changes within its range. This creates a direct mapping between color and pitch, where brighter colors produce higher pitches within their respective ranges. The pitch mapping works in conjunction with the harmonic distribution, so each color channel controls both the frequency and amplitude of its associated oscillators.

→ Audio: Pitch frequency, tonal center, color-to-pitch relationship
Formula: Red Pitch = 55 + (red / 2.0) × 55 Hz
Formula: Green Pitch = 110 + (green / 2.0) × 110 Hz
Formula: Blue Pitch = 220 + (blue / 2.0) × 220 Hz
Harmonic Series: Each color's base pitch is multiplied by harmonic ratios (2x, 3x, etc.)
Oscillator Types: Sine (red/fundamental/low), Triangle (green/mid), Sawtooth (blue/high)

Audio Architecture

The synthesizer consists of:

• 9 oscillators in harmonic series (fundamental + 8 partials)
• Each oscillator has random detuning for organic beating effects
• 1 LFO for frequency modulation (sine wave, from particle density)
• 2 wind LFOs for amplitude modulation (sine + triangle, simulating air movement)
• 1 filtered noise source for random particle movement (lowpass at 2 Hz)
• 1 lowpass filter per voice (timbre shaping, from particle size)
• 1 shared convolution reverb (spatial effects, from optical thickness)
• Master gain control (volume: 0.3)

Signal flow: Oscillators → Amplitude Modulation (Wind LFOs + Noise) → Mixer → Filter → Gain → Reverb → Master → Output

Modulation routing: Frequency Modulation LFO → Oscillator frequencies | Wind LFOs + Noise → Amplitude modulation

Real-Time Updates

All parameters update in real-time as you adjust the sliders. The visual rendering updates immediately via WebGL uniforms, and the audio synthesis parameters are continuously updated while the sound is playing. This creates a live, interactive experience where you can explore the relationship between atmospheric physics and both visual and sonic phenomena.

Presets

The weather presets (clear, hazy, polluted, pristine) automatically adjust particle density, optical thickness, and particle size mean to simulate different atmospheric conditions. These provide starting points for exploring different sonic and visual landscapes.

Sunset Sonata — Mapping Air to Sound Parameters