mp3

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: MIT Imports: 7 Imported by: 0

README

MP3

GoDoc Go Report Card Build Status codecov

Read and write MP3 files with DSP pipeline.

Documentation

Overview

Package mp3 provides pipe components that allow to read/write signal encoded in mp3 format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ABR

type ABR int

ABR uses average bit rate. Values: [8..320]

func (ABR) String

func (abr ABR) String() string

type BitRateMode

type BitRateMode interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

BitRateMode determines which VBR setting is going to be used.

type CBR

type CBR int

CBR uses constant bit rate. Values: [8..320]

func (CBR) String

func (cbr CBR) String() string

type ChannelMode

type ChannelMode int

ChannelMode determines how channel data will be encoded.

const (
	// Mono forcibly generates a mono file. If the input file is a stereo file,
	// the input stream will be read as a mono by averaging the left and right channels.
	Mono ChannelMode = iota
	// Stereo makes no use of potential similarity between the two input channels.
	// It can, however, negotiate the bit demand between both channels, i.e. give
	// one channel more bits if the other contains silence.
	Stereo
	// JointStereo make use of a correlation between both channels. The signal
	// will be matrixed into a sum ("mid") and difference ("side") signal. For quasi-mono
	// signals, this will give a significant gain in encoding quality. This mode does
	// not destroy phase information like IS stereo that may be used by other encoders.
	JointStereo
)

func (ChannelMode) String

func (cm ChannelMode) String() string

type Pump

type Pump struct {
	io.Reader
	// contains filtered or unexported fields
}

Pump allows to read mp3 data. This component cannot be reused for consequent runs.

func (*Pump) Pump

func (p *Pump) Pump(sourceID string) (func(signal.Float64) error, signal.SampleRate, int, error)

Pump reads buffer from mp3.

type Sink

type Sink struct {
	io.Writer
	BitRateMode
	ChannelMode
	// contains filtered or unexported fields
}

Sink allows to write mp3 files.

func (*Sink) Flush

func (s *Sink) Flush(string) error

Flush cleans up buffers.

func (*Sink) SetQuality

func (s *Sink) SetQuality(q int)

SetQuality sets the quality to the lame encoder. Quality determines encoding algorithm quality. It doesn't affect file size. Use [0-9] values. It is strictly optional. Default 5 is used if no value provided.

func (*Sink) Sink

func (s *Sink) Sink(sourceID string, sampleRate signal.SampleRate, numChannels int) (func(signal.Float64) error, error)

Sink writes buffer into destination.

type VBR

type VBR int

VBR uses variable bit rate. Values: [0..10]

func (VBR) String

func (vbr VBR) String() string

Jump to

Keyboard shortcuts

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