gfmedia

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChunkSizeTooLarge = fmt.Errorf("riff chunk size too large")
	ErrChunkSizeInvalid  = fmt.Errorf("riff chunk size invalid")
	ErrExtraChunkInvalid = fmt.Errorf("extra riff chunk invalid")
)
View Source
var (
	ErrNonstandardWavFile = fmt.Errorf("nonstandard wav file")
)

Functions

This section is empty.

Types

type Data

type Data struct {
	DataChunkID   [4]byte
	DataChunkSize uint32
}

type Extra

type Extra struct {
	SubChunk
}

func (Extra) IsValid

func (e Extra) IsValid() bool

func (Extra) Len

func (e Extra) Len() int

type Extras

type Extras []Extra

func (Extras) Len

func (e Extras) Len() int

func (Extras) Marshal

func (e Extras) Marshal() ([]byte, error)

type Fmt

type Fmt struct {
	FmtStandard
	FmtExtra
}

func (Fmt) Len

func (f Fmt) Len() int

type FmtExtra

type FmtExtra struct {
	UnknownFmtBytes []byte
}

type FmtStandard

type FmtStandard struct {
	FmtChunkID    [4]byte
	FmtChunkSize  uint32
	AudioFormat   uint16
	NumChannels   uint16
	SampleRate    uint32
	ByteRate      uint32
	BlockAlign    uint16
	BitsPerSample uint16
}

type PcmAudio

type PcmAudio struct {
	// contains filtered or unexported fields
}

func NewPcmAudio

func NewPcmAudio(raw []byte) *PcmAudio

func (PcmAudio) ToWav

func (a PcmAudio) ToWav(h *WavHead) (*WavAudio, error)

type Riff

type Riff struct {
	ChunkID   [4]byte
	ChunkSize uint32
	Format    [4]byte
}

func (Riff) Len

func (r Riff) Len() int

type SubChunk

type SubChunk struct {
	SubChunkID   [4]byte
	SubChunkSize uint32
	SubChunkData []byte
}

func (SubChunk) Len

func (s SubChunk) Len() int

type WavAudio

type WavAudio struct {
	// contains filtered or unexported fields
}

func NewWavAudio

func NewWavAudio(raw []byte) *WavAudio

func (*WavAudio) GetHead

func (a *WavAudio) GetHead() (*WavHead, error)

func (WavAudio) ToPcm

func (a WavAudio) ToPcm() (*PcmAudio, error)

type WavHead

type WavHead struct {
	Riff
	Fmt
	Extras
	Data
}

func NewWavHead

func NewWavHead(numChannels uint16, sampleRate uint32, bitsPerSample uint16,
	bodyLen uint32, extras ...Extra) *WavHead

func (*WavHead) Deserialize

func (h *WavHead) Deserialize(raw []byte) error

func (*WavHead) ExtendFmtChunk

func (h *WavHead) ExtendFmtChunk(ext FmtExtra) *WavHead

func (*WavHead) Len

func (h *WavHead) Len() int

func (*WavHead) Serialize

func (h *WavHead) Serialize() ([]byte, error)

Jump to

Keyboard shortcuts

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