go-dsp: github.com/mjibson/go-dsp/wav Index | Files

package wav

import "github.com/mjibson/go-dsp/wav"

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

Package Files

wav.go

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

Header contains Wav fmt chunk data.

type Wav Uses

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 Uses

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

New reads the WAV header from r.

func (*Wav) ReadFloats Uses

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

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

func (*Wav) ReadSamples Uses

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.

Package wav imports 7 packages (graph) and is imported by 1 packages. Updated 2016-07-17. Refresh now. Tools for package owners.