Stoatworks Labs

Atrac

A MiniDisc-style perceptual coder for Resolume

Betav0.1.0Plugin & ModuleC++ / GLSL
Atrac — A MiniDisc-style perceptual coder for Resolume
Atrac

What it does

An FFGL effect for Resolume Arena and Avenue. ATRAC, the perceptual coder MiniDisc used, throws detail away by bits rather than by resolution. The signal's cut into overlapping blocks, each one goes through a modified discrete cosine transform, the coefficients are grouped into block floating units with a scale factor and a word length each, and a fixed budget of bits per block is shared out by a masking model, so a band sitting next to a loud band gets few bits or none.

Atrac runs that coder on the picture as a separable two-dimensional lapped transform with a fixed budget per cell. Every artefact comes from that budget and that transform, and none of it is drawn on. Fine texture goes first because it's at the back of the queue. A hard edge rings one block either side because quantisation noise is a sum of basis functions over the whole window, and short blocks keep it in. The allocation is worked out again every frame, so texture shimmers at low rates. And a cell that runs out of bits falls to grey.

On top of that sits the disc. A MiniDisc reads faster than it plays, into a shock-proof buffer, and a knock stops the read. Here the knock is an audio onset or the Knock button. The buffer drains, and only if it runs dry does playback break and the picture hold until the buffer's refilled. Buffer, Read Speed and Knock Length are in seconds and a multiplier, worked out in double on the CPU.

Show Bits paints every cell as its own coefficient plane, with each band's word length as heat, and Show Blocks draws the grid and tints the cells the transient detector switched to short blocks. Modelled on ATRAC-style coding from the published description of the format; ATRAC and MiniDisc are trademarks of Sony Group Corporation, and this project is not affiliated with or endorsed by Sony.

  • A separable 2-D lapped transform (the MDCT) with exact long/short block switching
  • Block floating units with ATRAC1's scale-factor and word-length laws
  • A fixed bit budget per cell, spent by a greedy on noise-to-mask ratio
  • A masking model with a stated spread, offset and absolute floor
  • The shock-proof buffer: Buffer, Read Speed, Knock Length, a Knock button and audio onsets
  • Show Bits and Show Blocks diagnostic views
  • Universal macOS bundle and a Windows x64 DLL

Where it stands

v0.1.0, and early days. It hasn't been loaded into Resolume on macOS yet. On Windows it has: a build loads, registers and renders in Resolume Arena 7.27.1 on software rendering (no GPU), with every parameter as declared. Buffer, Read Speed and Knock Length couldn't be shown moving there, because they only act during a knock and the test can't press the button, and the audio controls were skipped because that machine has no sound device. The rest is measured offline, by a harness driving the real plugin: at unlimited bits the transform gives back the input within a rounding bound worked out from the arithmetic, every cell spends at most its budget, an edge's noise stays within the block it should, SNR rises with Bit Rate, Masking does what it says, and a knock breaks playback only when it outlasts the buffer. It catches twelve models broken on purpose and a one-character sabotage of its own shader, and all 13 swept controls change the picture. At the defaults it costs 4.9 ms a frame at 1080p and 16 ms at 4K on macOS, which is a whole 60 fps frame, and nothing has been optimised yet. The masking model is stated rather than tuned, and nobody has measured what Resolume's 64 FFT bins carry. There's a user guide and a browser demo (a port, with no audio), but no presets and no OpenFX port. Try it in your own rig before you trust it in a show.

Watch it running

Atrac video thumbnail

Nothing loads from YouTube until you press play.Watch it there instead