Audio

Audio🔗

LocalGPT Gen includes a procedural environmental audio system built on FunDSP. The system synthesizes natural-sounding ambient soundscapes and spatial sound emitters that respond to camera position in real-time.

Ambient Sounds🔗

Global soundscapes that loop continuously with natural variation:

SoundDescription
windPink noise with LFO-modulated lowpass (speed, gustiness)
rainWhite noise bandpass with AM modulation (intensity)
forestPink noise layer + sine chirps for birds (bird_density, wind)
oceanBrown noise with slow amplitude LFO + foam hiss (wave_size)
caveSine chirps (drips) + quiet brown noise (drip_rate, resonance)
streamLayered white/brown noise + bandpass (flow_rate)
silenceNo ambient sound

All ambient sounds use LFO modulation (0.05–0.3 Hz) to ensure natural variation — no two moments sound identical.

Setting Ambience🔗

gen_set_ambience({
  "layers": [
    {
      "name": "wind",
      "sound": { "type": "wind", "speed": 0.5, "gustiness": 0.3 },
      "volume": 0.6
    },
    {
      "name": "birds",
      "sound": { "type": "forest", "bird_density": 0.4, "wind": 0.2 },
      "volume": 0.4
    }
  ],
  "master_volume": 0.8
})

Emitter Sounds🔗

Spatial audio sources that respond to camera distance and direction:

SoundDescription
waterWhite noise bandpass + brown undertone (turbulence)
fireBrown rumble + noise bursts (intensity, crackle)
humSine + harmonics with detune (frequency, warmth)
windPink noise with LFO modulation (pitch)
customDirect waveform → filter (waveform, filter_cutoff, filter_type)

Emitters support spatial rendering:

  • Volume attenuation: Quadratic falloff within radius
  • Stereo panning: Left/right based on camera relative direction

Creating Emitters🔗

gen_audio_emitter({
  "name": "campfire_sound",
  "entity": "campfire",      // Attach to existing entity
  "sound": { "type": "fire", "intensity": 0.6, "crackle": 0.5 },
  "radius": 15.0,
  "volume": 0.8
})

Or position standalone:

gen_audio_emitter({
  "name": "waterfall",
  "position": [10.0, 0.0, 5.0],
  "sound": { "type": "water", "turbulence": 0.8 },
  "radius": 20.0,
  "volume": 0.7
})

Modifying Emitters🔗

gen_modify_audio({
  "name": "campfire_sound",
  "volume": 0.9,
  "sound": { "type": "fire", "intensity": 0.8, "crackle": 0.6 }
})

Auto-Inference🔗

The system automatically detects entity names and assigns audio:

KeywordsSound
waterfall, fountainWater (turbulence: 0.8)
river, waterWater (turbulence: 0.5)
stream, creek, brookWater (turbulence: 0.3)
fire, campfire, torch, flame, bonfireFire
generator, machine, engine, motorHum
vent, fan, wind_turbineWind

To override auto-inference, call gen_audio_emitter explicitly with a different sound.

Querying Audio State🔗

gen_audio_info({})

Returns current ambience layers, active emitters, volumes, and positions.