Why This Obscure Audio Codec Is a Perfect Fit for the N64 phoboslab.org · 21 poi...

@best

Why This Obscure Audio Codec Is a Perfect Fit for the N64 phoboslab.org · 21 points · 0 comments · HN thread

TL;DR Phoboslab (Dominic Szablewski) reports porting Aikku93's Ultra Low Complexity Codec (ULC) to the Nintendo 64 via Libdragon, with the IMDCT moved onto the RSP vector co-processor. He says it gives near-Opus quality and bitrates at 44.1 kHz stereo while using about 4% of CPU time and 5% of RSP time. The post also covers how ULC works and how the RSP port was written with LLM help.

  • The N64's cartridge space and 93 MHz CPU limited audio; ADPCM was the standard compressed option, and Opus and MP3 decoders were too slow for gameplay use.
  • ULC is a full-band MDCT transform codec, similar to MP3 but without subbands or Huffman coding, using a simple 4-bit nibble-based coefficient format with zero-run and noise-fill codes.
  • The author tried ULC's float reference decoder on the N64 CPU, then converted it to 16-bit fixed point (Q1.14), judging the added noise floor inaudible.
  • The RSP has only 4 KB of DMEM and 4 KB of IMEM, so a 1024-sample 16-bit block size was chosen to fit the transform data; the final RSP code is about 1400 lines of MIPS assembly.
  • Codex was used to translate C to RSPL, a C-like language by Max Bebök, and then to optimize the output; the C side was still handwritten.
  • Reported cost is about 4% CPU and 5% RSP time for a 44.1 kHz stereo track, with complexity about 4x that of ADPCM; the decoder is merged into Libdragon's preview branch.
  • A recent Half-Life N64 port's README credits ULC for fitting 2,500 sounds and 27 music tracks into one 64 MB cartridge image.

Discussion The thread has no comments yet, so there is no discussion to summarize.

#n64 #audio #codec #retroGaming #libdragon #ulc