🌊 ADC / DAC Signal Sampling

Adjust sample rate · Trigger aliasing below Nyquist · Change bit depth · See quantization noise

Input Signal

ADC Parameters

⚠ ALIASING: f_ADC < 2·f_signal

ADC Info

Nyquist frequency
Sampling ratio
Quantization levels
SQNR (approx)

Nyquist Theorem

f_ADC ≥ 2 · f_signal

CD Audio: 44100 Hz samples 22050 Hz max.

SQNR ≈ 6.02·N + 1.76 dB where N = bit depth.
8-bit → ~50 dB · 16-bit → ~98 dB.

📊 ADC / DAC — Signal Sampling & Aliasing

Explore analog-to-digital and digital-to-analog conversion. See how sample rate, bit depth and the Nyquist limit interact — and what happens when aliasing distorts a signal beyond recovery.

🔬 What It Demonstrates

The fundamental trade-off between sample rate (temporal resolution) and bit depth (amplitude resolution). When the sample rate drops below twice the signal frequency (Nyquist limit), aliasing creates phantom frequencies that cannot be removed.

🎮 How to Use

Adjust the sample rate slider to see aliasing appear when it falls below the Nyquist frequency. Change bit depth to observe quantisation noise. Compare the original, sampled and reconstructed waveforms.

💡 Did You Know?

The Nyquist–Shannon sampling theorem (1949) guarantees perfect reconstruction only if the sample rate exceeds twice the signal's highest frequency. This is why CD audio uses 44.1 kHz — just above 2 × 20 kHz.

About ADC / DAC Signal Sampling

This simulation shows how a continuous analogue signal is converted to digital form and back again. A pure sine wave is sampled at discrete instants and rounded to a finite set of amplitude levels (quantisation), then reconstructed as the DAC output. The behaviour is governed by the Nyquist–Shannon sampling theorem, which requires the sample rate to be at least twice the signal frequency for faithful capture.

Three sliders drive the model: the input signal frequency (100–5000 Hz), the ADC sample rate (500–20000 Hz) and the bit depth (1–12 bits). Lowering the sample rate below 2·f_signal triggers aliasing, folding the tone to a phantom frequency, while reducing bit depth coarsens the quantisation steps. The same physics underpins digital audio, CD recording, software-defined radio and every data-acquisition system.

Frequently Asked Questions

What is ADC and DAC?

ADC (analogue-to-digital conversion) turns a continuous voltage into a stream of numbers by sampling it in time and rounding each sample to a fixed number of levels. DAC (digital-to-analogue conversion) reverses the process, rebuilding an analogue waveform from those numbers. This page visualises the original signal, the sampled ADC output and the reconstructed DAC output stacked together.

What is the Nyquist theorem?

The Nyquist–Shannon sampling theorem states that a band-limited signal can be reconstructed perfectly only if the sample rate is at least twice its highest frequency, written f_ADC ≥ 2·f_signal. The Nyquist frequency is half the sample rate, so it is the maximum signal frequency the system can represent without error.

What causes aliasing in this simulation?

Aliasing appears when you drop the sample rate below 2·f_signal. Too few samples per cycle make a high-frequency tone masquerade as a lower one. The simulation computes the alias as the value of |f_signal − k·f_ADC| that falls below f_ADC/2, turns the sample stems red and flags the warning badge.

What do the three sliders control?

The signal frequency slider sets the input tone from 100 to 5000 Hz. The sample rate slider sets f_ADC from 500 to 20000 Hz, deciding how often the wave is measured. The bit depth slider, from 1 to 12 bits, sets how many amplitude levels (2 to 4096) are available for quantisation.

What is bit depth and quantisation noise?

Bit depth N determines the number of discrete amplitude levels, equal to 2^N. With fewer bits the steps between levels are larger, so each sample is rounded more coarsely and the rounding error appears as quantisation noise. At 1 bit the wave becomes a crude two-level staircase; at 12 bits the 4096 levels make the staircase almost smooth.

What does SQNR mean and how is it calculated?

SQNR is the signal-to-quantisation-noise ratio, a measure of how cleanly the converter represents a signal. The simulation uses the standard approximation SQNR ≈ 6.02·N + 1.76 dB, where N is the bit depth. Each extra bit adds roughly 6 dB, so 8 bits give about 50 dB and 16 bits about 98 dB.

What is the sampling ratio shown in the stats?

The sampling ratio is f_ADC divided by f_signal, displayed as a multiple such as 4.00x. A ratio of 2 sits exactly at the Nyquist limit, so anything above 2 satisfies the theorem and anything below it causes aliasing. Higher ratios give more samples per cycle and a more faithful reconstruction.

Why does the reconstructed signal sometimes look wrong?

When aliasing occurs, the DAC can only rebuild the signal from the samples it received, and those samples are consistent with a lower alias frequency rather than the true tone. The reconstructed row therefore shows the alias, not the original, demonstrating that aliasing destroys information that no later processing can recover.

Is this simulation physically accurate?

It captures the core ideas faithfully: uniform sampling, mid-tread quantisation to 2^N levels, the Nyquist condition and the 6.02·N + 1.76 dB SQNR rule are all standard. It simplifies by using an ideal sine input and omitting anti-aliasing filters, sample-and-hold artefacts and reconstruction filtering, so it is a teaching model rather than a circuit-level emulator.

Why does CD audio use 44.1 kHz?

Human hearing tops out near 20 kHz, and the Nyquist theorem requires sampling above twice that, so at least 40 kHz. The 44.1 kHz rate leaves headroom for a practical anti-aliasing filter and has historical roots in early digital video tape storage. You can mimic this by setting f_signal near the audio limit and f_ADC just above twice it.

How can I avoid aliasing in a real system?

Place an analogue anti-aliasing low-pass filter before the ADC to remove any content above the Nyquist frequency, then choose a sample rate comfortably above twice the highest frequency of interest. Oversampling further eases the filter requirements. In this simulation you simply raise the sample rate until the green Nyquist-satisfied badge appears.