wave

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BITS_PER_BYTE                 = 8
	MIN_CHUNK_HEADER_SIZE         = 8
	MIN_DATASIZE_CHUNK_SIZE       = 28
	LENGTH_DATASIZE_TABLE_ENTRIES = 12
)

* Global constants.

View Source
const (
	MAX_INT24      = 0x007fffff       // int32
	MIN_INT24      = -(MAX_INT24 + 1) // int32
	SIGN_BIT_INT24 = 0x00800000       // int32
	SIZE_INT24     = 3
)

* Constants for handling of 24-bit integers.

View Source
const (
	AUDIO_PCM             = 0x0001     // uint16
	AUDIO_IEEE_FLOAT      = 0x0003     // uint16
	DEFAULT_BIT_DEPTH     = 0x0010     // uint16
	FORMAT_WAVE           = 0x45564157 // uint32
	ID_BW64               = 0x34365742 // uint32
	ID_DATA               = 0x61746164 // uint32
	ID_DATASIZE           = 0x34367364 // uint32
	ID_FORMAT             = 0x20746d66 // uint32
	ID_RIFF               = 0x46464952 // uint32
	ID_RIFF64             = 0x34364652 // uint32
	MIN_CHUNK_SIZE_FORMAT = 0x00000010 // uint32
	MIN_TOTAL_HEADER_SIZE = 0x0000002c // uint32
)

* RIFF header constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel interface {
	Clear()
	Floats() []float64
	WriteFloats(samples []float64)
}

* An interface type representing the channels inside a RIFF wave file.

type File

type File interface {
	BitDepth() uint16
	Bytes() ([]byte, error)
	Channel(id uint16) (Channel, error)
	ChannelCount() uint16
	SampleFormat() uint16
	SampleRate() uint32
}

* An interface type representing a RIFF wave file.

func CreateEmpty

func CreateEmpty(sampleRate uint32, sampleFormat uint16, bitDepth uint16, channelCount uint16) (File, error)

* Create an empty wave file with the desired sample rate, sample format, bit depth and channel count.

func FromBuffer

func FromBuffer(buffer []byte) (File, error)

* Creates a wave file from the contents of a byte buffer.

Jump to

Keyboard shortcuts

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