How to Import and Play Sound Effects in Godot 4
October 30, 2026 · 6 min read
Godot makes audio refreshingly simple, but a few import settings decide whether your loops are seamless and your footsteps sound natural. This guide walks through importing, playing, looping and randomizing sound effects in Godot 4.
1. Pick the format
- WAV for short sound effects. Godot imports it as an
AudioStreamWAV, which is cheap to play. - OGG for long sounds and loops (ambience, engines). Godot imports it as an
AudioStreamOggVorbis, which keeps files small.
MP3 is supported in Godot 4 too, but OGG is the better choice for loops. More in WAV vs OGG vs MP3.
2. Import
Copy the files into your project folder, for example res://audio/sfx/. Godot imports them automatically. Select a file in the FileSystem dock and open the Import dock to see its settings. After changing anything, click Reimport.
3. Set up looping
- OGG: enable Loop in the Import dock.
- WAV: set Loop Mode to Forward in the Import dock (or leave it disabled for one-shot effects).
For ambience, generate the sound with the loop option turned on in SFX Loom so the end already flows into the start, then enable looping on import.
4. Play a sound
Godot has three player nodes:
AudioStreamPlayer: non-positional, for UI and music.AudioStreamPlayer2D: positioned in a 2D scene, pans and fades with distance.AudioStreamPlayer3D: positioned in 3D space.
Add one as a child of your node, assign the sound to its Stream property, and play it from a script:
@onready var jump_sfx: AudioStreamPlayer2D = $JumpSfx
func jump() -> void:
velocity.y = JUMP_VELOCITY
jump_sfx.play()To let several instances overlap (rapid gunfire, for example), raise the player’s Max Polyphony above 1.
5. Randomize variations
Godot 4 has a built-in AudioStreamRandomizer resource. Create one in the player’s Stream property, add your takes to its stream list, and set Random Pitch and Random Volume Offset Db. Every call to play() then picks a different take with a slight variation, with no extra code.
This is ideal for footsteps, hits and impacts. In SFX Loom, set variations to 4 when generating and download each take.
6. Use audio buses
Open the Audio panel at the bottom of the editor and add buses such as SFX, UI, Ambience and Music. Set each player’s Bus property, and you can balance levels and add effects (reverb for a cave area, for example) per bus. Volume sliders in your settings menu can then use AudioServer.set_bus_volume_db().
Checklist
- WAV for short effects, OGG for loops
- Loop enabled in the Import dock for ambience
- The right player node: plain, 2D or 3D
- Max Polyphony above 1 for overlapping sounds
- AudioStreamRandomizer for footsteps and hits
- Separate buses for SFX, UI, ambience and music
Looking for sounds to drop in? Start with the indie game sound effects checklist, then generate them free.
More guides