opus-aac-stream

command
v0.6.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

opus-aac-stream

Offline encode -> packetize -> decode benchmark and verification harness for macOS AudioToolbox AudioConverter Opus (kAudioFormatOpus) and AAC (kAudioFormatMPEG4AAC) codecs via x/audiocodec with CGO_ENABLED=0.

No microphone, CoreAudio IO device, or macOS TCC permission prompt is required. The program synthesizes a 24 kHz / 48 kHz multi-tone float32 waveform, streams it in 20 ms chunks through audiocodec.Encoder and audiocodec.Decoder, and verifies delay-aligned SNR (> 25 dB), compression ratio (>= 8x), per-20 ms encode+decode latency (< 1 ms), and real-time factor (RTF < 0.05).

Usage

CGO_ENABLED=0 go run ./examples/audiotoolbox/opus-aac-stream
CGO_ENABLED=0 go run ./examples/audiotoolbox/opus-aac-stream -dur 5s

Exit status is 1 if any profile fails a quality, compression, or latency gate.

Measured Output

Apple M4 Max, macOS 26.6.2, go1.27.0 darwin/arm64, CGO_ENABLED=0, -dur 2s:

Profile Packets PCM (KB) Encoded (KB) Ratio SNR (dB) Lat / 20 ms RTF
Opus 24kHz mono 64kbps 101 187.5 18.9 9.92x 28.73 171.91µs 0.00860
Opus 48kHz mono 48kbps 101 375.0 12.6 29.75x 28.66 180.808µs 0.00904
AAC 24kHz mono 48kbps 49 187.5 4.2 45.10x 35.11 39.807µs 0.00199
AAC 48kHz mono 64kbps 96 375.0 5.9 63.27x 34.36 66.581µs 0.00333

Documentation

Rendered for darwin/amd64

Overview

Command opus-aac-stream benchmarks and verifies offline Opus and AAC encode -> packetize -> decode round-trips using AudioToolbox AudioConverter via x/audiocodec. No microphone or audio hardware permissions are required.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL