mp3

package module
v0.3.3 Latest Latest
Warning

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

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

README

go-mp3

GoDoc

An MP3 decoder in pure Go based on PDMP3.

Slide at golang.tokyo #11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

A Decoder is a MP3-decoded stream.

Decoder decodes its underlying source on the fly.

func NewDecoder

func NewDecoder(r io.Reader) (*Decoder, error)

NewDecoder decodes the given io.Reader and returns a decoded stream.

The stream is always formatted as 16bit (little endian) 2 channels even if the source is single channel MP3. Thus, a sample always consists of 4 bytes.

func (*Decoder) Length

func (d *Decoder) Length() int64

Length returns the total size in bytes.

Length returns -1 when the total size is not available e.g. when the given source is not io.Seeker.

func (*Decoder) Read

func (d *Decoder) Read(buf []byte) (int, error)

Read is io.Reader's Read.

func (*Decoder) SampleRate

func (d *Decoder) SampleRate() int

SampleRate returns the sample rate like 44100.

Note that the sample rate is retrieved from the first frame.

func (*Decoder) Seek

func (d *Decoder) Seek(offset int64, whence int) (int64, error)

Seek is io.Seeker's Seek.

Seek panics when the underlying source is not io.Seeker.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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