wav

package
v0.0.0-...-793ea6c Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: BSD-3-Clause Imports: 8 Imported by: 11

Documentation

Overview

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

μ-law
a-law

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:

http://www.sonicspot.com/guide/wavefiles.html
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/

Index

Constants

This section is empty.

Variables

View Source
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.

Functions

func NewEncoder

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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