Game dev
Saved & recent

Audio sample

Related terms: sample rate, bit depth, waveform, PCM, streaming

Digital sound is a long list of numbers: the air pressure measured many times per second. Each number is a sample. The sample rate is how many are taken per second, usually 44,100 or 48,000. Bit depth is how precise each one is.

Short effects are loaded into memory whole. Music is long, so it is stored compressed and streamed from disk a piece at a time.

Further reading
Godot: AudioStreamWAV
0 41.7 83.3 125.0 166.7 -1 -0.5 0 0.5 1 time (µs) relative amplitude 0 +5 +4 +3 +1 −4 −6 −3 0 20.8 µs stored sample sample codes
At 48,000 samples per second, measurements are about 20.8 µs apart. The outlined dots mark the measured amplitudes. The filled dots and signed integers show an illustrative 4-bit encoding.

View in the full Game dev collection