Documentation ¶
Index ¶
- Variables
- type ErrIncorrectChunkSize
- type File
- type Reader
- func (wav Reader) FirstSampleOffset() uint32
- func (wav *Reader) GetAudioFormat() uint16
- func (wav *Reader) GetBitsPerSample() uint16
- func (wav *Reader) GetBytesPerSec() uint32
- func (wav Reader) GetDumbReader() (r io.Reader, err error)
- func (wav *Reader) GetDuration() time.Duration
- func (wav Reader) GetFile() File
- func (wav *Reader) GetNumChannels() uint16
- func (wav *Reader) GetSampleCount() uint32
- func (wav *Reader) GetSampleRate() uint32
- func (wav *Reader) ReadRawSample() ([]byte, error)
- func (wav *Reader) ReadSample() (n int32, err error)
- func (wav *Reader) ReadSampleEvery(every uint32, average int) (samples []int32, err error)
- func (wav *Reader) Reset() (err error)
- func (wav Reader) String() string
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInputToLarge error ErrInputToLarge = errors.New("Input too large") // ErrNotRiff error ErrNotRiff = errors.New("Not a RIFF file") // ErrNotWave error ErrNotWave = errors.New("Not a WAVE file") // ErrBrokenChunkFmt error ErrBrokenChunkFmt = errors.New("could not decode chunkFmt") // ErrNoBitsPerSample error ErrNoBitsPerSample = errors.New("could not decode chunkFmt") // ErrFormatNotSupported error ErrFormatNotSupported = errors.New("Format not supported - Only uncompressed PCM currently") )
Functions ¶
This section is empty.
Types ¶
type ErrIncorrectChunkSize ¶
type ErrIncorrectChunkSize struct {
Got, Wanted uint32
}
ErrIncorrectChunkSize struct
func (ErrIncorrectChunkSize) Error ¶
func (e ErrIncorrectChunkSize) Error() string
type File ¶
type File struct { SampleRate uint32 SignificantBits uint16 Channels uint16 NumberOfSamples uint32 Duration time.Duration AudioFormat uint16 SoundSize uint32 Canonical bool BytesPerSecond uint32 }
File describes the WAV file
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps WAV stream
func NewReader ¶
func NewReader(rd io.ReadSeeker, size int64) (wav *Reader, err error)
NewReader returns a new WAV reader wrapper
func (Reader) FirstSampleOffset ¶
FirstSampleOffset in the WAV stream
func (*Reader) GetAudioFormat ¶
GetAudioFormat returns the audio format. A value of 1 indicates uncompressed PCM. Any other value indicates a compressed format
func (*Reader) GetBitsPerSample ¶
GetBitsPerSample returns the number of bits per sample
func (*Reader) GetBytesPerSec ¶
GetBytesPerSec returns the number of bytes per second of audio. ie: byte rate
func (Reader) GetDumbReader ¶
GetDumbReader gives you a std io.Reader, starting from the first sample. usefull for piping data.
func (*Reader) GetDuration ¶
GetDuration returns the length of audio
func (*Reader) GetNumChannels ¶
GetNumChannels returns the number of audio channels
func (*Reader) GetSampleCount ¶
GetSampleCount returns the number of samples
func (*Reader) GetSampleRate ¶
GetSampleRate returns the sample rate
func (*Reader) ReadRawSample ¶
ReadRawSample returns the raw []byte slice
func (*Reader) ReadSample ¶
ReadSample returns the parsed sample bytes as integers
func (*Reader) ReadSampleEvery ¶
ReadSampleEvery returns the parsed sample bytes as integers every X samples
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer encapsulates a io.WriteSeeker and supplies Functions for writing samples
func (*Writer) WriteInt32 ¶
WriteInt32 writes the sample to the file using the binary package
func (*Writer) WriteSample ¶
WriteSample writes a []byte array to file without conversion