ac3

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 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 ac3 encodes AC-3 (Dolby Digital, ATSC A/52): PCM in, frames any AC-3 decoder plays out. 48 kHz, mono to 5.1, the bit rates A/52 allows; long blocks, no coupling.

Index

Constants

View Source
const Delay = 256

Delay is how many samples the coded audio lags its input: the first frame's first block overlaps silence before the input.

View Source
const FrameSamples = 1536

FrameSamples is how many samples per channel a frame codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder codes PCM as AC-3 frames.

func NewEncoder

func NewEncoder(channels int, lfe bool, kbps int) (*Encoder, error)

NewEncoder makes an encoder for channels (1 to 6; with lfe, 4 or 6, the last of them the LFE channel), at 48 kHz and kbps kb/s.

Channels are given in AC-3's order: L, C, R, Ls, Rs (as many as there are: L, R for stereo; L, C, R; L, R, Ls, Rs), then LFE.

func (*Encoder) EncodeFrame

func (e *Encoder) EncodeFrame(pcm [][]float64) ([]byte, error)

EncodeFrame codes FrameSamples samples of each channel (in [-1, 1], AC-3 order) as one frame.

func (*Encoder) FrameSize

func (e *Encoder) FrameSize() int

FrameSize is the bytes of each frame.

Jump to

Keyboard shortcuts

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