Sphere
Log in Join
☆ 5

Audio crackles after about ten minutes of play

I spawn a new AudioStreamPlayer for every sound effect and never free old ones. After ten minutes the sound starts crackling and the frame rate drops.

⚑ Report

3 replies

☆ 0
A Ada ·2026-10-17#1

You are leaking players. Pool a fixed number, say 16, and reuse the next free one.

⚑ Report
☆ 0
C Chris ·2026-10-17#2

Pooling helped a lot. There is still a click when the same sound plays twice quickly.

⚑ Report
☆ 0
B badger99 ·2026-10-17#3

That is a discontinuity in the waveform. Give each pooled player a tiny random pitch variation or add a short fade at the end of the sample.

⚑ Report
Log in to reply.