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 ¶
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 ¶
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) SampleRate ¶
SampleRate returns the sample rate like 44100.
Note that the sample rate is retrieved from the first frame.
func (*Decoder) Seek ¶
Seek is io.Seeker's Seek.
Seek returns an error when the underlying source is not io.Seeker.
Note that seek uses a byte offset but samples are aligned to 4 bytes (2 channels, 2 bytes each). Be careful to seek to an offset that is divisible by 4 if you want to read at full sample boundaries.