Skip to content

roman01la/sigrok-web

Repository files navigation

sigrok viewer

Browser-based logic analyzer and signal viewer. A reimplementation of PulseView that runs entirely in the browser — no install, no native dependencies.

Live demo: https://sigrok.roman01la.workers.dev

Features

  • .sr file viewer — open sigrok session files via drag-and-drop or file picker
  • Live capture — connect fx2lafw-based USB logic analyzers via WebUSB
  • Protocol decoders — built-in UART, I2C, SPI; plus the full sigrok Python decoder library via Pyodide
  • Native libsigrok — the actual sigrok C library compiled to WebAssembly for fast, bit-for-bit compatible file parsing
  • WebGPU rendering — compute shaders for LOD generation and edge detection, instanced rendering for waveforms; falls back to Canvas 2D

Navigation

Scroll Zoom in / out
Drag Pan left / right
+ - Zoom in / out
Pan
F / Home Fit capture to view

Click a channel label to apply a protocol decoder.

Architecture

Three tiers of functionality, each with a fallback:

  1. Tier 1 — TypeScript file loader + decoders (works offline, no dependencies)
  2. Tier 2 — WebUSB live capture from fx2lafw devices
  3. Tier 3 — Pyodide-hosted Python decoders from the sigrok decoder library

Plus two rendering paths:

  • WebGPU — instanced line/quad rendering, GPU compute for LOD min/max reduction and logic transition detection
  • Canvas 2D — fallback when WebGPU is unavailable

Native libsigrok is compiled to WASM (libffi → glib → libzip → libsigrok → wrapper) for the file loading hot path.

Development

npm install
npm run dev      # vite dev server
npm test         # vitest
npm run build    # production build to dist/
npm run deploy   # build + deploy to Cloudflare Workers
npm run preview  # build + run wrangler dev locally

Project layout

src/
  main.ts             app entry, UI, render loop
  loader.ts           .sr file parser (TypeScript)
  waveform.ts         data structures, LOD generation
  viewport.ts         time ↔ pixel transform
  renderer.ts         Canvas 2D renderer
  types.ts            shared types
  decoders/           UART, I2C, SPI
  gpu/                WebGPU context, shaders, compute, renderer
  wasm/               native libsigrok WASM bridge
  webusb/             fx2lafw device protocol + capture
  pyodide/            Python decoder runtime in a worker
native/               C sources, build script for libsigrok WASM

Hardware

The WebUSB capture path supports fx2lafw-compatible devices (Cypress FX2 chip): generic 24 MHz 8-channel "Saleae clone" analyzers, plus various branded models. ~$15 on AliExpress.

License

MIT

About

Browser-based logic analyzer and signal viewer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors