Field Guide · term

Also known as: pitch codebook, adaptive codebook, algebraic codebook, fixed codebook

The ACELP codebooks are the two sources of excitation that the TETRA ACELP decoder combines each subframe to drive the LPC synthesis filter: an adaptive (pitch) codebook for the periodic component of voiced speech and an algebraic (fixed) codebook for the noise-like innovation.1 This two-codebook excitation is the defining structure of every CELP-family coder; what makes it algebraic is that the fixed codebook is a rule for placing a few signed pulses rather than a stored table.

adaptive codebookdelay T0 + frac/3 algebraic codebook4 signed pulses Σ gains 1/A(z)synthesis
Each subframe the pitch and algebraic codebooks are scaled by their gains and summed into the excitation that drives the LPC synthesis filter.

The adaptive (pitch) codebook

Voiced speech is quasi-periodic at the pitch, so the cheapest way to model its excitation is to reuse the recent past. The adaptive codebook does exactly that: for each of the 60 samples in a subframe it copies the excitation from T0 samples earlier, where T0 is the transmitted pitch lag. Because true pitch rarely lands on an integer sample, ACELP resolves the lag to ±1/3 of a sample. When the fractional part is non-zero the decoder interpolates with a 32-tap fractional-delay filter — GopherTrunk stores the two tap sets, inter32Coef1_3 and inter32CoefM1_3, for the +1/3 and −1/3 offsets in internal/voice/acelp/codebook.go. The predLt routine (a port of the reference Pred_Lt) selects the integer-copy path for frac == 0 and the interpolating path otherwise, reconstructing the periodic component sample by sample.

The algebraic (fixed) codebook

Whatever periodicity the pitch codebook cannot explain — the noise-like innovation, transients, and unvoiced energy — is supplied by the algebraic codebook. TETRA’s is a four-pulse design over the 60-sample subframe: a 14-bit index encodes four pulse positions on interleaved tracks, each pulse carrying amplitude +1 or −1. GopherTrunk’s algebraicPulses unpacks the index into the four positions, and dD4i60 (a port of the reference D_D4i60) builds the codeword and convolves it with the perceptual noise-shaping filter F[]. The first pulse is scaled by √2 — the constant q11GainI0 = 2896, √2 in Q11 — and a whole-codeword sign flip and a 0/1 sample shift complete the reconstruction. Storing only four positions and signs is what lets ACELP represent a very large excitation space in a handful of bits, the property that gave the algorithm its name and its efficiency.

Combining the two

The subframe excitation is the sum of the two codebook contributions, each multiplied by its own gain from the gain dequantizer. That excitation drives the all-pole LPC synthesis filter whose coefficients come from the LSP codebooks, and the filter output — after the decoder’s post-processing — is the reconstructed speech. Crucially, today’s excitation becomes tomorrow’s history: the pitch codebook on the next subframe delays this subframe’s excitation, so the two codebooks are coupled through a feedback buffer. That coupling is why a scanner must carry enough valid excitation history before each subframe (predLt’s caller guarantees pitMax + lInter samples of it) and why an erased frame must run concealment rather than simply muting — a gap in the history would corrupt every subsequent pitch prediction.

Relevance to SDR

For decoding, the codebooks are deterministic reconstruction rules: given the transmitted pitch lag, fraction, algebraic index, sign, and shift, they rebuild the exact excitation the encoder chose. The heavy analysis-by-synthesis search that picks those parameters lives only in the encoder, so GopherTrunk’s TETRA voice path implements just the lightweight synthesis side. The codebook ports are exercised as part of the ACELP decoder’s end-to-end conformance against the ETSI reference codec, so a decoded call’s excitation is bit-faithful rather than merely plausible.

Sources

  1. Algebraic code-excited linear prediction — Wikipedia, on the adaptive and algebraic codebook structure of ACELP. 

See also