Skip to main content

Interactive PySide6 + manim demonstration of how an ADC works

Project description

cicadc

An interactive desktop program that demonstrates how an analog-to-digital converter (ADC) works. It shows two side-by-side panels rendered with manim inside a PySide6 window:

  • Left panel (analog) - the analog signal drawn as a path that scrolls past "now" (the middle line), with the future at the top and the past at the bottom. A blue car drives along the (clean) analog signal and turns to follow the path. A "shadow" car marks the converter output at now - pale green when a decimator is active (the coarse quantizer/modulator output) or white/gray otherwise (the digital output). Noise is added before the converter, not on the displayed analog curve.
  • Right panel (digital) - the digital signal as a sample-and-hold staircase. Pale green is the coarse quantizer/modulator output and white/gray is the decimated/filtered digital output (normalised to unity gain at the signal frequency). A white/gray car follows the digital output, trailing by the filter's group delay so it lands back on the analog curve (delay-compensated).

The ADC can run as a plain Nyquist-rate uniform quantizer or as a 1st- or 2nd-order sigma-delta modulator (with optional dither); a sigma-delta bitstream is decimated by a cascaded sinc^N (CIC-style) moving-average filter matched to the modulator order.

Project layout

src/cicadc/          package (src layout, mirrors cicwave)
  cli.py             click console entry point (`cicadc`)
  app.py             QApplication bootstrap
  main_window.py     PySide6 window + controls
  manim_scene.py     offscreen manim renderer
  signal_source.py   analog signal model (sinusoid + noise)
  quantizer.py       N-bit quantizer
  render_widget.py   Qt widget + animation loop
  assets/car.png     car sprite
tests/unittests/     unittest suite

Requirements

  • Python 3.9-3.13 (manim does not yet support 3.14). A python3.12 venv is used by the setup steps below.
  • A working manim install (Cairo backend). On macOS you may need the system libraries pkg-config cairo pango via Homebrew if the wheels do not cover your platform.

Setup

python3.12 -m venv .venv
source .venv/bin/activate
pip install -e .          # or: pip install -r requirements.txt

make dev-install runs the editable install for you.

Run

cicadc                   # installed console script
# or, from a checkout without installing:
python main.py

Controls

  • Frequency / Amplitude - the input sinusoid (sliders; amplitude is a fraction of full scale).
  • Speed - how fast the signal scrolls past "now".
  • Bits - resolution of the quantizer / modulator.
  • Sample period - the ADC sample clock interval.
  • Noise - additive noise amplitude, applied before the converter.
  • ADC type - Nyquist quantizer, or 1st-/2nd-order sigma-delta modulator.
  • Dither - deterministic dither for the sigma-delta quantizer (ΣΔ modes only).
  • Avg - decimation/averaging length on the digital output (1 = off); uses a sinc^N cascade matched to the ADC type.
  • Play / Pause - start or stop the animation.

A signal-chain bar above the view highlights the active path (Analog → Noise → Quantizer/ΣΔ → Filter → Digital).

Development

make test     # run unit tests
make check    # import and print version
make lint     # ruff (if installed)
make build    # build wheel + sdist

Acknowledgements

Big thanks to Domen Visnar for the idea behind this project!

Rendering

The manim scene is rasterised offscreen (Cairo) and painted into the Qt widget. Cost scales with pixel count, so resolution and frame rate trade off; the default is 1280x896 at 30 fps, with the static scenery cached so only the moving content is rebuilt each frame.

Status

Single sinusoid input, adjustable bit depth, noise, Nyquist and 1st-/2nd-order sigma-delta ADCs, a sinc^N decimation filter with delay compensation, and the signal-chain bar are implemented. Random / multi-sinusoid inputs and a configurable bandwidth filter are planned follow-ups.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cicadc-0.2.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cicadc-0.2.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file cicadc-0.2.0.tar.gz.

File metadata

  • Download URL: cicadc-0.2.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cicadc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 23c3b0b17b362ec5d10ade4e7039a9f44db1ea16d5cad912ba20ab5dc8854160
MD5 a0c22235d4f421b377ec66db62167f57
BLAKE2b-256 a6d5771865278fc49e0b4dac58e0316a09a50d4d9be7703dc79b7682bfd0d49e

See more details on using hashes here.

File details

Details for the file cicadc-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cicadc-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cicadc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfb2dd2d32e458c0813222fb899fc055297eb2bef4cb011f6faaa3cb62fe81c
MD5 0d814978870d568894d9e13ec7421c76
BLAKE2b-256 06c837654321a9d025a6121c383a834e3e72b70e3f47248c9ae94927106dcaa8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page