pcm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 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 pcm contains stateful, provider-neutral PCM stream utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resampler

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

Resampler incrementally converts mono signed 16-bit little-endian PCM with linear interpolation. A Resampler is stateful and must be used by one stream at a time. Push never invents a right-hand sample at a frame boundary; Finalize supplies the terminal hold sample and fixes the exact output length. This makes output independent of how input is partitioned into frames.

func NewResampler

func NewResampler(inputRate, outputRate uint32) (*Resampler, error)

NewResampler creates a mono PCM16 stream resampler.

func (*Resampler) Finalize

func (resampler *Resampler) Finalize() ([]byte, error)

Finalize returns the terminal samples. It is valid exactly once.

func (*Resampler) InputRate

func (resampler *Resampler) InputRate() uint32

InputRate returns the immutable source sample rate.

func (*Resampler) OutputRate

func (resampler *Resampler) OutputRate() uint32

OutputRate returns the immutable destination sample rate.

func (*Resampler) Push

func (resampler *Resampler) Push(input []byte) ([]byte, error)

Push consumes another sample-aligned PCM16LE fragment and returns all output samples that no longer depend on future input.

Jump to

Keyboard shortcuts

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