sample-rates

command
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0 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.

Documentation

Overview

Package main demonstrates sample-rate handling and the int16 PCM API.

Opus always codes internally at 48 kHz, but the public API accepts and produces PCM at any supported rate (8000, 12000, 16000, 24000, 48000 Hz): create the encoder and decoder at your rate and gopus resamples at the boundary. This is the natural fit for telephony / VoIP front ends that work at 8 kHz or 16 kHz.

It also shows the int16 API (EncodeInt16 / DecodeInt16), which most OS and hardware audio paths use directly, avoiding a manual float conversion.

At a given rate, a 20 ms frame is rate/50 samples per channel (160 at 8 kHz, 960 at 48 kHz). Decode returns samples per channel at the same rate.

Usage:

go run ./examples/sample-rates

Jump to

Keyboard shortcuts

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