What this does
This script implements gravitational lens reverb — an advanced audio processing technique that simulates the effects of gravitational physics on sound propagation. Creates complex, curved delay patterns inspired by gravitational lensing, where massive objects bend the path of sound waves, combined with relativistic time dilation effects. Process models multiple gravitational masses that bend audio "rays" through curved spacetime.
Key Features:
- 4 Lensing Presets — From subtle curvature to extreme spacetime distortion
- Gravitational Mass Simulation — Multiple mass points with individual strengths
- Ray Bending Algorithm — Audio rays curved by gravitational attraction
- Time Dilation Effects — Relativistic time stretching near masses
- Stereo Field Curvature — Independent left/right gravitational fields
- Natural Fadeout — Cosmological horizon-style decay
What is gravitational lens reverb? Traditional reverb: linear delay lines, uniform decay. Gravitational reverb: simulates how sound would behave in curved spacetime, with delays that bend around simulated masses and time that stretches near gravitational sources. Advantages: (1) Complex curvature: Non-linear delay patterns create unique spatial effects. (2) Physical simulation: Based on actual gravitational mathematics. (3) Rich textures: Multiple mass interactions create complexity. (4) Stereo immersion: Independent gravitational fields per channel. (5) Scientific inspiration: Real astrophysical phenomena translated to audio. Use cases: Cosmic sound design, experimental music, film scoring, scientific visualization, immersive audio.
Quick start
- Select Sound object in Praat
- Run
gravitational_lens_reverb.praat
- Choose preset for pre-configured gravitational environments
- Or adjust mass_points and rays_per_mass for complexity
- Set space_curvature for bending intensity
- Configure time_dilation_factor for relativistic effects
- Click OK — gravitational reverb applied
Quick tip: Start with Medium Lensing for balanced cosmic effects. Use Subtle Lensing for gentle spatial curvature or Extreme Lensing for dramatic spacetime distortion. Each processing creates unique gravitational environments.
Processing Intensity: High mass point counts with many rays can require significant processing time. The script automatically handles stereo/mono conversion and creates appropriate cosmic tails.
Gravitational Theory
Gravitational Lensing Algorithm
🌌 Mass-Ray Interaction System
Core gravitational simulation:
For each mass point (1 to mass_points):
mass_position = randomUniform(0.03, 0.9) ; Position in time
mass_strength = randomGauss(mass_strength_mean, mass_strength_stddev)
For each ray (1 to rays_per_mass):
straight_delay = ray_delay_start + ray × ray_delay_increment
# Gravitational bending calculation
distance_to_mass = abs(straight_delay - mass_position)
bending = mass_strength / (distance_to_mass + 0.005)
curved_delay = straight_delay + bending × space_curvature
# Relativistic effects
time_dilation = sqrt(1 - mass_strength × time_dilation_factor)
lensing_amp = lensing_amplitude / (1 + bending)
# Apply delayed signal
Formula: "self + lensing_amp × self(x - curved_delay × time_dilation)"
Physical interpretation:
Each mass creates a gravitational well
Audio rays bend toward masses (longer paths)
Time slows near massive objects (time dilation)
Amplitude decreases with bending (energy conservation)
Relativistic Time Dilation
⏰ Einstein's Time Stretching
Time dilation mathematics:
Time dilation formula (simplified):
time_dilation = √(1 - mass_strength × time_dilation_factor)
Where:
mass_strength = gravitational influence of mass point
time_dilation_factor = controls relativistic intensity
Effects:
Near strong masses: time_dilation → 0 (extreme slowing)
Far from masses: time_dilation → 1 (normal time)
Creates: stretched delays, pitch shifts, temporal smearing
Audio implementation:
delayed_signal = self(x - curved_delay × time_dilation)
Stronger masses create more time stretching
Multiple masses create complex temporal patterns
Physical basis:
Inspired by general relativity
Gravitational time dilation near massive objects
Translated to audio delay manipulation
Parameter Interactions
| Parameter | Physical Analog | Audio Effect |
| mass_points | Number of stars/black holes | More masses = more complex reverb patterns |
| rays_per_mass | Light paths around each mass | More rays = denser, richer reverberation |
| space_curvature | Strength of spacetime curvature | Higher = more dramatic delay bending |
| mass_strength_mean | Average mass of objects | Higher = stronger gravitational effects |
| time_dilation_factor | Relativistic intensity | Higher = more time stretching effects |
| lensing_amplitude | Signal intensity | Controls reverb loudness and presence |
Stereo Gravitational Fields
Independent channel processing:
Left channel:
Uses main parameter settings
Creates primary gravitational field
Standard mass distribution and strength
Right channel:
Slightly different parameters:
mass_strength_mean = 1.1 (slightly weaker)
space_curvature = 0.75 (less curvature)
ray_delay_start = 0.06 (later start)
ray_delay_increment = 0.055 (different spacing)
time_dilation_factor = 0.18 (slightly more dilation)
Benefits:
Natural stereo imaging
Different gravitational environments per ear
Creates immersive cosmic space
Avoids artificial symmetry
For mono sounds:
Process with left channel parameters, then convert to stereo
Lensing Presets
| Preset | Mass Points | Rays/Mass | Curvature | Time Dilation | Cosmic Character |
| Subtle Lensing | 6 | 5 | 0.5 | 0.10 | Gentle spatial curvature, minimal distortion |
| Medium Lensing | 12 | 8 | 0.8 | 0.15 | Balanced cosmic environment |
| Heavy Lensing | 18 | 12 | 1.1 | 0.20 | Strong gravitational fields, noticeable time effects |
| Extreme Lensing | 25 | 16 | 1.5 | 0.25 | Intense spacetime distortion, relativistic effects |
🌠 Cosmic Environment Applications
Subtle Lensing: Create gentle cosmic spaces for ambient music and subtle spatial enhancement. Minimal time dilation preserves original timing.
Medium Lensing: Generate balanced cosmic reverberation for most musical applications. Noticeable curvature without overwhelming distortion.
Heavy Lensing: Produce strong gravitational environments for sound design and experimental music. Clear time dilation and spatial bending effects.
Extreme Lensing: Create intense spacetime distortion for cinematic scoring and cosmic sound design. Maximum relativistic effects and complex curvature.
Cosmological Fadeout System
Natural decay simulation:
fadeout_duration (0.8-1.8 seconds):
Controls reverb tail length
Simulates cosmological horizon
Creates natural, non-abrupt endings
Fadeout formula:
fade_start = total_duration - fadeout_duration
if x > fade_start:
amplitude = 0.5 + 0.5 × cos(π × (x - fade_start) / fadeout_duration)
output = input × amplitude
Physical inspiration:
Cosmic microwave background redshift
Signal attenuation over cosmic distances
Horizon effects in expanding universe
Benefits:
Natural-sounding decay
Prevents abrupt endings
Creates sense of infinite space
Matches cosmic theme of effect
Applications
Cosmic Sound Design
Space and Sci-Fi Effects: Use Heavy or Extreme Lensing to create authentic cosmic environments for science fiction media. The gravitational simulation creates believable space acoustics.
Astrophysical Visualization: Process audio to demonstrate gravitational concepts. The time dilation and lensing effects provide audible analogs to relativistic phenomena.
Experimental Music
Cosmic Composition: Use gravitational reverb as a compositional tool to create spatial narratives that evolve through different cosmic environments.
Temporal Exploration: Study how time dilation affects musical perception. The relativistic effects create unique rhythmic and harmonic transformations.
Cinematic Scoring
Epic Space Scenes: Apply Extreme Lensing to create massive, cosmic spaces for film scores and game soundtracks involving space travel or cosmic events.
Alien Environments: Use the unique curvature patterns to create unfamiliar acoustic spaces that suggest alien worlds or alternate physics.
Technical Considerations
Processing Time: High mass point counts (18+) with many rays can require significant processing time, especially for long audio files. The gravitational calculations are computationally intensive.
Extreme Parameters: Very high space_curvature combined with strong time_dilation can create extreme effects that may overwhelm the original signal. Start with moderate settings.
Scientific Basis: While simplified for audio processing, the gravitational lensing and time dilation mathematics are inspired by real physics. The effect provides an intuitive understanding of these complex concepts through audio.