mp3

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package mp3 provides a pure-Go MP3 encoder used to compress completed call audio before it is streamed to broadcast aggregators (Broadcastify Calls, RdioScanner, OpenMHz, Icecast).

It wraps the fixed-point Shine encoder, so the daemon keeps its zero-CGO single-binary guarantee — no libmp3lame / libshine at build or runtime. Shine supports the MPEG-1, MPEG-2 and MPEG-2.5 sample-rate families, so 8 kHz digital-voice audio encodes directly with no resample stage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(samples []int16, sampleRate int) ([]byte, error)

Encode compresses mono 16-bit PCM sampled at sampleRate Hz into a complete MP3 byte stream. The input is treated as a single channel; callers with stereo audio must downmix first.

func EncodeWAVFile

func EncodeWAVFile(path string) ([]byte, int, error)

EncodeWAVFile reads a 16-bit PCM mono WAV file from path and returns the equivalent MP3 byte stream plus the source sample rate.

func ReadWAV

func ReadWAV(path string) ([]int16, int, error)

ReadWAV parses a canonical 16-bit PCM mono WAV file and returns its samples and sample rate. It tolerates extra chunks between `fmt ` and `data` (e.g. LIST/INFO) by walking the chunk list. Only mono 16-bit PCM is supported — the format the recorder writes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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