Obscure audio codec is a perfect fit for the N64 phoboslab.org · 264 points · 31...

@best30

Obscure audio codec is a perfect fit for the N64 phoboslab.org · 264 points · 31 comments · HN thread

TL;DR Phoboslab describes porting Aikku93's Ultra Low Complexity Codec (ULC), a full-band MDCT transform codec, to the N64 with an RSP-accelerated decoder written in ~1400 lines of MIPS assembly via RSPL and LLM-assisted coding. He reports near-Opus quality and bitrates at about 4% CPU and 5% RSP time for 44.1 kHz stereo, and that ULC is now merged into libdragon's preview branch. The comments focus on N64 history (MP3 licensing, RDP fillrate), video codec patents, and objections to the LLM use.

  • The N64 had 8MB to 64MB cartridges and a 93 MHz CPU, so fully recorded audio was impractical; games relied on ADPCM and tracker-style samples.
  • Libdragon already had RSP-accelerated ADPCM and Opus decoders, but Opus was too slow to run during gameplay.
  • ULC uses a full-band MDCT and stores coefficients in a simple nibble-based syntax with zero-run, quantizer-change and noise-fill codes, avoiding Huffman entropy coding.
  • The RSP has only 4 KB of DMEM and 4 KB of IMEM, so the IMDCT was converted to 16-bit fixed point (Q1.14) with a 1024-sample block size.
  • The author reports about 4% CPU and 5% RSP time for a 44.1 kHz stereo track, with quality and bitrate close to Opus and complexity about 4x that of ADPCM.
  • The RSP code was ported with Codex from C via Max Bebök's RSPL language and iteratively optimized; the C side was handwritten.

Discussion The thread mixes admiration for the engineering with nostalgia about the N64 and tangents about codec licensing. Early comments say ULC would have been impossible in 1999 because of MP3 patent licensing, which explains why Nintendo and Rare paid for a decoder license. A long side discussion covers the N64's weak points, including RDP fillrate and the small texture buffer, and another covers AV1 and H.265 licensing. Several commenters point to the wave of new N64 ports (Half-Life, Duke Nukem 3D, Portal 64). The mood is mostly enthusiastic, with a notable minority objecting to the author's use of LLMs.

  • Impressive engineering and a clever codec design (many): Commenters praise ULC as a clean, elegant MP3-like design and admire fitting it into the N64's constrained RSP and CPU. Some see it as useful for other old or constrained hardware too.
  • Objection to using LLMs in the project (some): A few commenters say the demoscene and homebrew culture is threatened by LLM-assisted work. Others reply that the issue is how AI is used and that transpiling code with it is not a serious sin.
  • Patents and licensing held back codecs in the 1990s (some): One commenter explains that the N64 MP3 decoder was licensed from Fraunhofer and RAD Game Tools to avoid lawsuits, and that a license cost around $250k. They argue a codec like ULC would have been blocked by patent lawyers then.
  • Video codec licensing is still a mess (some): Commenters discuss H.265 licensing and OEM pricing, and argue AV1 is royalty-free and performs as well as H.265. Others note that the free Windows HEVC extension is still obtainable.
  • Demo audio choice was poor (a few): One commenter found the vocals in the demo hard to understand. The author replied that the original track sounds the same and replaced the video with a better one.
  • N64 hardware limits and its underrated design (a few): Commenters debate whether RDP fillrate or the texture buffer was the N64's weakest part, and one argues the console introduced real-time rendering ideas that were ahead of their time.

Links from the comments

#audioCodecs #N64 #libdragon #retroGaming #RSP #LLMs