1# timeseries-compressibility
3Interactive exploration of how compressible quantized time series are.
5The generating model is: i.i.d. Gaussian noise (std σ, measured in quantization
6steps) → FIR filter → optional additive uniform dither on [-½, ½) → round to
7integers. The app shows the filter (convolution kernel and frequency response,
8with cutoffs in Hz against a chosen sample rate), a window of the generated
9integer signal (stationary by default, with a play toggle to let it stream
10endlessly), and the measured compression of a 120,000-sample
11block under nine methods — zlib, zstd, and an rANS entropy coder, each raw,
12delta-coded, and LPC-residual-coded — as bits per sample and as ratio against
13raw int16 storage.
15Alongside the measurements it plots the theoretical bits/sample: the entropy
16rate of the stationary filtered Gaussian process quantized at unit step, in the
17high-resolution limit,
19```
20R = ½ log₂(2πe) + ∫₀^½ log₂ S(f) df, S(f) = σ² |H(f)|²
21```
23LPC + ANS should approach R — and does, where the formula is valid. Where the
24filter's stopband pushes S(f) below one step² (see the dashed threshold on the
25response plot), the formula under-predicts and can go negative; making that
26breakdown visible is part of the point. The math section is a stub for the full
27derivation.
29## Run it
31```sh
32npm install
33npm run dev
34```
36## Layout
38```
39src/model/ the pipeline (seeded Gaussian stream, FIR presets, dither,
40 rounding) and the entropy-rate integral
41src/compress/ lossless codecs run in the browser: zlib (fflate), zstd (wasm),
42 ans.ts (a bit-identical port of simple_ans), and FLAC-style
43 integer LPC; borrowed from entropy-quantized-linear-transform
44src/worker/ the codecs run off the main thread on a debounced parameter set
45src/components/ controls, filter plots, scrolling canvas, compression chart
46```
48Every reported size round-trips through the decoder and includes whatever the
49decoder needs (ANS symbol table, LPC coefficients). The compression block and
50the scrolling display are fed by the same `Pipeline`, so what is compressed is
51what is shown.