wav

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package wav is direct WAV filo I/O

Package wav is direct WAV filo I/O

Package wav is direct WAV filo I/O

Package wav is direct WAV filo I/O

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureOutput

func ConfigureOutput(s spec.AudioSpec)

func Load

func Load(path string) (out []sample.Sample, specs *spec.AudioSpec)

Load a WAV file into memory

func OutputNext

func OutputNext(numSamples spec.Tz) (err error)

func OutputStart

func OutputStart(length time.Duration)

func TeardownOutput

func TeardownOutput()

Types

type Data

type Data struct {
	io.Reader
	Size uint32
	// contains filtered or unexported fields
}

type Format

type Format struct {
	SampleFormat  SampleFormat
	NumChannels   uint16
	SampleRate    uint32
	ByteRate      uint32
	BlockAlign    uint16
	BitsPerSample uint16
}

the Format struct must be in the exact order according to WAV specifications, such that a binary.Read(...) can assign the WAV specified "fmt" header bytes to the correct Format properties.

func FormatFromSpec

func FormatFromSpec(s *spec.AudioSpec) Format

type Reader

type Reader struct {
	Format      *Format
	AudioFormat spec.AudioFormat
	*Data
	// contains filtered or unexported fields
}

func NewReader

func NewReader(file riff.RIFFReader) (reader *Reader, err error)

func (*Reader) ReadSamples

func (r *Reader) ReadSamples(params ...uint32) (out []sample.Sample, err error)

type SampleFormat

type SampleFormat uint16
const (
	AudioFormatLinearPCM SampleFormat = 0x0001
	AudioFormatIEEEFloat SampleFormat = 0x0003
)

type Writer

type Writer struct {
	io.Writer
	Format *Format
}

func NewWriter

func NewWriter(w io.Writer, format Format, length time.Duration) (writer *Writer)

Jump to

Keyboard shortcuts

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