params

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package params defines the codec-parameter payload used by the WAV format plugin for Microsoft and IMA ADPCM streams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SamplesPerBlock

func SamplesPerBlock(codec media.CodecID, channels int, blockAlign uint16) (uint16, error)

SamplesPerBlock derives the WAV ADPCM samples-per-block value from block alignment.

Types

type ADPCM

type ADPCM struct {
	BlockAlign      uint16
	SamplesPerBlock uint16
	Coefficients    []Coefficient
}

ADPCM contains the framing parameters shared by a WAV ADPCM stream and its codec. Coefficients is used only by Microsoft ADPCM.

func Default

func Default(codec media.CodecID, channels int) (ADPCM, error)

Default returns the compatibility default used for newly encoded ADPCM streams.

func Parse

func Parse(codec media.CodecID, channels int, data []byte) (ADPCM, error)

Parse decodes and validates a SchemaADPCMV1 payload.

func (ADPCM) MarshalBinary

func (p ADPCM) MarshalBinary() []byte

MarshalBinary encodes an ADPCM parameter payload for SchemaADPCMV1.

func (ADPCM) Validate

func (p ADPCM) Validate(codec media.CodecID, channels int) error

Validate verifies parameters against the selected ADPCM codec and channel count.

type Coefficient

type Coefficient struct {
	Coeff1 int16
	Coeff2 int16
}

Coefficient is one Microsoft ADPCM predictor coefficient pair.

Jump to

Keyboard shortcuts

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