Documentation
¶
Overview ¶
Package wav reads and writes wave (.wav) file.
Index ¶
- Constants
- func Marshal(v *File) (stream []byte, err error)
- func Unmarshal(stream []byte, audio *File) (err error)
- type File
- func (v *File) AvgBytesPerSec() int
- func (v *File) BitsPerSample() int
- func (v *File) BlockAlign() int
- func (v *File) Bytes() []byte
- func (v *File) Channels() int
- func (v *File) Duration() time.Duration
- func (v *File) Float64s() []float64
- func (v *File) FormatTag() uint16
- func (v *File) Int32s() []int32
- func (v *File) Length() int
- func (v *File) Read(p []byte) (int, error)
- func (v *File) S16() []byte
- func (v *File) S24() []byte
- func (v *File) S32() []byte
- func (v *File) S8() []byte
- func (v *File) Samples() int
- func (v *File) SamplesPerSec() int
- func (v *File) String() string
- func (v *File) Write(b []byte) (n int, err error)
Constants ¶
const ( WAVE_FORMAT_PCM = 0x1 WAVE_FORMAT_EXTENSIBLE = 0xFFFE )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents WAV audio file.
func (*File) AvgBytesPerSec ¶
AvgBytesPerSec returns average bytes per second.
func (*File) BitsPerSample ¶
BitsPerSample returns bits per sample.
func (*File) BlockAlign ¶
BlockAlign returns block align size in byte.
func (*File) FormatTag ¶
FormatTag returns either 0x1 (WAVE_FORMAT_PCM) or 0xFFFE (WAVE_FORMAT_EXTENSIBLE).
func (*File) Length ¶
Length returns size of the audio except for headers in bytes. The returned value is same as len(v.Bytes()).
func (*File) Samples ¶
Samples returns number of the samples that the audio contains. For example, 10 seconds of the stereo audio which is encoded 16 bit / 44.1 kHz contains 882000 samples.
func (*File) SamplesPerSec ¶
SamplesPerSec returns number of samples per second. For example, CD quality audio is encoded as 44100 samples per second.