wav.v1: azul3d.org/audio/wav.v1 Index | Files

package wav

import "azul3d.org/audio/wav.v1"

Package wav decodes and encodes wav audio files.

The decoder is able to decode all wav audio formats (except extensible WAV formats), with any number of channels. These formats are:

8-bit unsigned PCM
16-bit signed PCM
32-bit signed PCM

32-bit floating-point PCM
64-bit floating-point PCM


The encoder is capable of encoding any audio data -- but it currently will convert all data to 16-bit signed PCM on-the-fly before writing to a file.

Ultimately this means regardless of what type of audio data you encode, it ends up as a 16-bit WAV file in the end. Future versions of this package will allow the encoder to output the same types as the decoder.

Please refer to the WAV specification for in-depth details about its file format:



Package Files

decoder.go doc.go encoder.go header.go structs.go


var ErrUnsupported = errors.New("wav: data format is valid but not supported by decoder")

ErrUnsupported defines an error for decoding wav data that is valid (by the wave specification) but not supported by the decoder in this package.

This error only happens for audio files containing extensible wav data.

func NewEncoder Uses

func NewEncoder(w io.WriteSeeker, conf audio.Config) (audio.Encoder, error)

NewEncoder creates a new WAV encoder, which stores the audio configuration in a WAV header and encodes any audio samples written to it. The contents of the WAV header and the encoded audio samples are written to w.

Note: The Close method of the encoder must be called when finished using it.

Package wav imports 8 packages (graph) and is imported by 3 packages. Updated 2016-07-19. Refresh now. Tools for package owners.