wav

package
v0.0.0-...-11479a3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: ISC Imports: 7 Imported by: 22

Documentation

Overview

Package wav provides support for the WAV file format.

Supported formats are PCM 8- and 16-bit, and IEEE float. Extended chunks (JUNK, bext, and others added by tools like ProTools) are ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	AudioFormat   uint16
	NumChannels   uint16
	SampleRate    uint32
	ByteRate      uint32
	BlockAlign    uint16
	BitsPerSample uint16
}

Header contains Wav fmt chunk data.

type Wav

type Wav struct {
	Header
	// Samples is the total number of available samples.
	Samples int
	// Duration is the estimated duration based on reported samples.
	Duration time.Duration
	// contains filtered or unexported fields
}

Wav reads wav files.

func New

func New(r io.Reader) (*Wav, error)

New reads the WAV header from r.

func (*Wav) ReadFloats

func (w *Wav) ReadFloats(n int) ([]float32, error)

ReadFloats is like ReadSamples, but it converts any underlying data to a float32.

func (*Wav) ReadSamples

func (w *Wav) ReadSamples(n int) (interface{}, error)

ReadSamples returns a [n]T, where T is uint8, int16, or float32, based on the wav data. n is the number of samples to return.

Jump to

Keyboard shortcuts

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