wav

package module
v0.0.0-...-1fe9dcb Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2015 License: GPL-2.0 Imports: 7 Imported by: 0

README

wav

GoDoc Build Status wercker status

golang .wav reader and writer

Todo

  • Use type WavFile for Reader
  • Implement Stereo interleaving

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInputToLarge = errors.New("Input too large")
	ErrNotRiff      = errors.New("Not a RIFF file")
	ErrNotWave      = errors.New("Not a WAVE file")

	ErrBrokenChunkFmt  = errors.New("could not decode chunkFmt")
	ErrNoBitsPerSample = errors.New("could not decode chunkFmt")

	ErrFormatNotSupported = errors.New("Format not supported - Only uncompressed PCM currently")
)

Functions

This section is empty.

Types

type ErrIncorrectChunkSize

type ErrIncorrectChunkSize struct {
	Got, Wanted uint32
}

func (ErrIncorrectChunkSize) Error

func (e ErrIncorrectChunkSize) Error() string

type File

type File struct {
	SampleRate      uint32
	SignificantBits uint16
	Channels        uint16
}

func (File) NewWriter

func (file File) NewWriter(out output) (wr *Writer, err error)

NewWriter creates a new WaveWriter and writes the header to it

type Reader

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

func NewReader

func NewReader(rd io.ReadSeeker, size int64) (wav *Reader, err error)

func (Reader) FirstSampleOffset

func (wav Reader) FirstSampleOffset() uint32

func (Reader) GetDumbReader

func (wav Reader) GetDumbReader() (r io.Reader, err error)

GetDumbReader gives you a std io.Reader, starting from the first sample. usefull for piping data.

func (Reader) GetFile

func (w Reader) GetFile() File

func (*Reader) GetSampleCount

func (wav *Reader) GetSampleCount() uint32

func (*Reader) ReadRawSample

func (wav *Reader) ReadRawSample() ([]byte, error)

func (*Reader) ReadSample

func (wav *Reader) ReadSample() (n int32, err error)

func (Reader) String

func (wav Reader) String() string

type Writer

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

Writer encapsulates a io.WriteSeeker and supplies Functions for writing samples

func (*Writer) Close

func (w *Writer) Close() error

Close corrects the filesize information in the header

func (*Writer) GetDumbWriter

func (w *Writer) GetDumbWriter() (wr output, countPtr *int32, err error)

GetDumbWriter gives you a std io.Writer, starting from the first sample. usefull for piping data.

func (*Writer) WriteInt32

func (w *Writer) WriteInt32(sample int32) error

WriteInt32 writes the sample to the file using the binary package

func (*Writer) WriteSample

func (w *Writer) WriteSample(sample []byte) error

WriteSample writes a []byte array to file without conversion

Directories

Path Synopsis
examples
plotWav command
simpleRead command
simpleSweep command

Jump to

Keyboard shortcuts

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