Help us shape the future of Go! Take the 2026 Go Developer Survey

mp3

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 5 Imported by: 294

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.ReadCloser) (*Decoder, error)

NewDecoder decodes the given io.ReadCloser 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) Close

func (d *Decoder) Close() error

Close is io.Closer's Close.

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