# Companding
<!-- MICROSIMGEN:BEGIN v1.7 — generated by g08_place_microsims.py; three.js first (§15); do not hand-edit inside -->
## Microsims — p5.js
### Companding (p5.js) · `μ-law`
<div class="microsim-player">
<iframe src="https://editor.p5js.org/sciencenibber/full/tyQSKmsZt" width="100%" height="480" frameborder="0" loading="lazy" sandbox="allow-scripts allow-same-origin" title="Companding — p5.js microsim"></iframe>
</div>
*Compress then expand: squeeze a signal's dynamic range before quantizing and restore it after, so quiet passages keep their resolution.*
**Open in the editor:** [▶ fork this sketch](https://editor.p5js.org/sciencenibber/sketches/tyQSKmsZt) · movement *I · Sampling, quantization & data conversion* · library `p5js`
### Related microsims
Live sims on neighbouring articles — 6 of them inside this article's own Wikipedia link tree:
- [[Convolution]] *(in tree)*
- [[Data_compression]] *(in tree)*
- [[Delta_modulation]] *(in tree)*
- [[Differential_pulse-code_modulation]] *(in tree)*
- [[Discrete_cosine_transform]] *(in tree)*
- [[Discrete_wavelet_transform]] *(in tree)*
*Sim hosted off-article; the article owns the reference, not the runtime (WIKI_RULES §10.4). Placed by `g08_place_microsims.py`.*
<!-- MICROSIMGEN:END -->
## Links (Wikipedia order)
<!-- injected from _registry/childlinks/Companding.json (2026-07-30T02:09:12Z) -->
`842_(compression_algorithm)` · `A-law_algorithm` · `Adaptive_Huffman_coding` · `Adaptive_coding` · `Adaptive_differential_pulse-code_modulation` · `Algebraic_code-excited_linear_prediction` · `Analog-to-digital_converter` · `Analog_recording` · `Arithmetic_coding` · `Asymmetric_numeral_systems` · `Au_file_format` · `Audio_codec` · `Average_bitrate` · `Bit_rate` · `Brotli` · `Burrows–Wheeler_transform` · `Byte-pair_encoding` · `Bzip2` · `Canonical_Huffman_code` · `Chain_code` · `Chroma_subsampling` · `Code-excited_linear_prediction` · `Coding_tree_unit` · `Color_space` · `Compressed_data_structure` · `Compressed_suffix_array` · `Compression_artifact` · `Constant_bitrate` · `Context_mixing` · `Context_tree_weighting` · [[Convolution]] · [[Data_compression]] · `Data_compression_symmetry` · `Daubechies_wavelet` · `David_A._Huffman` · `Deblocking_filter` · `Deflate` · `Delta_encoding` · [[Delta_modulation]] · `Dictionary_coder` · [[Differential_pulse-code_modulation]] · `Digital-to-analog_converter` · `Digital_synthesizer` · [[Discrete_cosine_transform]] · `Discrete_sine_transform` · [[Discrete_wavelet_transform]] · `Display_resolution` · `Dynamic_Markov_compression` · [[Dynamic_range]] · `Dynamic_range_compression` · `Elias_gamma_coding` · `Embedded_zerotrees_of_wavelet_transforms` · [[Entropy_(information_theory)]] · `Entropy_coding` · `Exponential-Golomb_coding` · `Exponentiation` · `FM-index` · [[Fast_Fourier_transform]] · `Fibonacci_coding` · `Film_frame` · `Fourier_transform` · `Fractal_compression` · `Frame_rate` · `Golomb_coding` · `Grammar-based_code` · `Huffman_coding` · `Hutter_Prize` · `IEEE_Transactions_on_Information_Theory` · [[Image_compression]] · `Image_resolution` · `Incremental_encoding` · [[Information_theory]] · `Interlaced_video` · `Kolmogorov_complexity` · `Korg` · `Korg_Trinity` · `LHA_(file_format)` · `LZ4_(compression_algorithm)` · `LZ77_and_LZ78` · `LZFSE` · `LZMA` · `LZRW` · `LZWL` · `LZX` · `Lapped_transform` · `Latency_(audio)` · `Lempel–Ziv–Oberhumer` · `Lempel–Ziv–Stac` · `Lempel–Ziv–Storer–Szymanski` · `Lempel–Ziv–Welch` · `Levenshtein_coding` · `Line_spectral_pairs` · `Linear_predictive_coding` · `Log_area_ratio` · `Lossless_compression` · `Lossy_compression` · `Macroblock` · `Mark_Adler` · `Modified_Huffman_coding` · `Modified_discrete_cosine_transform` · `Motion_compensation` · `Motion_estimation` · `Move-to-front_transform` · `Mu-law_algorithm` · [[Nyquist–Shannon_sampling_theorem]] · `PAQ` · `Peak_signal-to-noise_ratio` · `Phil_Katz` · `Pixel` · `Portmanteau` · `Prediction_by_partial_matching` · `Prefix_code` · `Psychoacoustics` · `Pyramid_(image_processing)` · `Quantization_(image_processing)` · [[Quantization_(signal_processing)]] · `Range_coding` · `Rate–distortion_theory` · `Re-Pair` · `Redundancy_(information_theory)` · `Robert_M._Gray` · `Roland_Corporation` · `Run-length_encoding` · `SIGSALY` · [[Sampling_(signal_processing)]] · `Sequitur_algorithm` · `Set_partitioning_in_hierarchical_trees` · `Shannon_coding` · `Shannon–Fano_coding` · `Shannon–Fano–Elias_coding` · [[Signal-to-noise_ratio]] · [[Signal_processing]] · `Silence_compression` · `Smallest_grammar_problem` · `Snappy_(compression)` · `Sound_quality` · [[Speech_coding]] · `Standard_test_image` · `Sub-band_coding` · `Successive-approximation_ADC` · `T-carrier` · [[Telecommunications]] · `Telephony` · `Texture_compression` · `Timeline_of_information_theory` · `Transform_coding` · `Tunstall_coding` · `Unary_coding` · `Universal_code_(data_compression)` · `Variable_bitrate` · `Video` · `Video_codec` · `Video_compression_picture_types` · `Video_quality` · `WAV` · `Warped_linear_predictive_coding` · `Wavelet_transform` · `Wireless_microphone` · `Yamaha_Corporation` · `Zstd`
> Signal Processing concept · part of the Signal Processing Portal · movement I · !73 計算 keisan.svg
<!-- RENDER-THUMB:START -->
!480
*Rendered from the live microsim (▶ motion).*
<!-- RENDER-THUMB:END -->
## See it next
[](Quantization_error)
*→ Quantization error*
<!-- VISUAL-LINK:END -->
---
Back to Signal Processing Portal · the room · Semiotic gateway
<!-- REAL-GENERATIVE-MEDIA:START -->
## What it is
Companding (a portmanteau of **com**pressing and ex**panding**) is a technique that compresses the dynamic range of a signal before transmission or quantization and then expands it afterward, so that small signals are effectively encoded with finer resolution.
## How it works / why it matters
A nonlinear compressor amplifies low-amplitude samples more than high-amplitude ones before uniform quantization, and a complementary expander undoes the mapping at the receiver. This approximates non-uniform quantization, keeping the signal-to-quantization-noise ratio roughly constant across a wide range of input levels rather than degrading badly for quiet signals. Standard laws are the **μ-law** (used in North America and Japan) and the **A-law** (used in Europe) for 8-bit telephone-quality speech; both let 8 bits of companded audio sound comparable to about 12–13 bits of uniform quantization. Companding is thus a way of matching quantization resolution to how signals and human hearing are actually distributed.
## Signs & universals
Instantiates: encoding · amplitude · signal · noise.
## Related
Refines [[Quantization_(signal_processing)]] by shaping Quantization error non-uniformly, and is commonly applied within Pulse-code modulation telephony (μ-law / A-law). It sits in the same digitization chain as Analog-to-digital conversion and its converter, the Analog-to-digital converter.
<!-- VISUAL-LINK:START -->
## From the Real GENERATIVE library
> In telecommunications and signal processing, companding (occasionally called compansion) is a method of mitigating the detrimental effects of a channel with limited dynamic range. The name is a portmanteau of the words compressing and expanding, which are the functions of a compander at the transmitting and receiving ends, respectively. ([Wikipedia](https://en.wikipedia.org/wiki/Companding))
<!-- REAL-GENERATIVE-MEDIA:END -->
<!-- CRAFT-LINK:START g12 -->
*Built to the [[WT!P5_js_Microsim_Master_Class|p5.js Master Class]].*
<!-- CRAFT-LINK:END -->
## Wikipedia : Wikitube
**Strict pair:** [Wikipedia](https://en.wikipedia.org/wiki/Companding) : [Wikitube](https://en.wikitube.io/wiki/Companding)
## Previous hub tags
Tree parent: [[Information_theory]].
Legacy hubs: none.
---
*Sources: 1 legacy note. Minted wave 1, 2026-07-30 (v1.6 order).*