lame

package module
v0.0.0-...-49a063e Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: MIT Imports: 4 Imported by: 2

README

lame

Simple libmp3lame powered mp3 encoder for Go

Note: this project is obsolete, consider moving to https://github.com/viert/go-lame

Example:

package main

import (
  "bufio"
  "lame"
  "os"
)

func main() {
  f, err := os.Open("input.raw")
  if err != nil {
    panic(err)
  }
  defer f.Close()
  reader := bufio.NewReader(f)

  of, err := os.Create("output.mp3")
  if err != nil {
    panic(err)
  }
  defer of.Close()

  wr := lame.NewWriter(of)
  wr.Encoder.SetBitrate(112)
  wr.Encoder.SetQuality(1)

  // IMPORTANT!
  wr.Encoder.InitParams()

  reader.WriteTo(wr)

}

Documentation

Index

Constants

View Source
const (
	STEREO        = C.STEREO
	JOINT_STEREO  = C.JOINT_STEREO
	DUAL_CHANNEL  = C.DUAL_CHANNEL /* LAME doesn't supports this! */
	MONO          = C.MONO
	NOT_SET       = C.NOT_SET
	MAX_INDICATOR = C.MAX_INDICATOR
	BIT_DEPTH     = 16

	VBR_OFF     = C.vbr_off
	VBR_RH      = C.vbr_rh
	VBR_ABR     = C.vbr_abr
	VBR_MTRH    = C.vbr_mtrh
	VBR_DEFAULT = C.vbr_default

	MAX_FRAME_SIZE = 2880
)
View Source
const (
	ABR_8   = C.ABR_8
	ABR_320 = C.ABR_320
	V9      = C.V9
	VBR_10  = C.VBR_10
	V8      = C.V8
	VBR_20  = C.VBR_20
	V7      = C.V7
	VBR_30  = C.VBR_30
	V6      = C.V6
	VBR_40  = C.VBR_40
	V5      = C.V5
	VBR_50  = C.VBR_50
	V4      = C.V4
	VBR_60  = C.VBR_60
	V3      = C.V3
	VBR_70  = C.VBR_70
	V2      = C.V2
	VBR_80  = C.VBR_80
	V1      = C.V1
	VBR_90  = C.VBR_90
	V0      = C.V0
	VBR_100 = C.VBR_100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

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

func Init

func Init() *Encoder

func (*Encoder) Bitrate

func (e *Encoder) Bitrate() int

func (*Encoder) Close

func (e *Encoder) Close()

func (*Encoder) Encode

func (e *Encoder) Encode(buf []byte) []byte

func (*Encoder) Flush

func (e *Encoder) Flush() []byte

func (*Encoder) GetLametagFrame

func (e *Encoder) GetLametagFrame() []byte

func (*Encoder) ID3TagAddV2

func (e *Encoder) ID3TagAddV2()

func (*Encoder) InSamplerate

func (e *Encoder) InSamplerate() int

func (*Encoder) InitId3Tag

func (e *Encoder) InitId3Tag()

func (*Encoder) InitParams

func (e *Encoder) InitParams() int

func (*Encoder) Mode

func (e *Encoder) Mode() int

func (*Encoder) NumChannels

func (e *Encoder) NumChannels() int

func (*Encoder) Quality

func (e *Encoder) Quality() int

func (*Encoder) SetBitrate

func (e *Encoder) SetBitrate(bitRate int)

func (*Encoder) SetInSamplerate

func (e *Encoder) SetInSamplerate(sampleRate int)

func (*Encoder) SetLowPassFrequency

func (e *Encoder) SetLowPassFrequency(frequency int)

func (*Encoder) SetMode

func (e *Encoder) SetMode(mode C.MPEG_mode)

func (*Encoder) SetNumChannels

func (e *Encoder) SetNumChannels(num int)

func (*Encoder) SetQuality

func (e *Encoder) SetQuality(quality int)

func (*Encoder) SetVBR

func (e *Encoder) SetVBR(mode C.vbr_mode)

func (*Encoder) SetVBRAverageBitRate

func (e *Encoder) SetVBRAverageBitRate(averageBitRate int)

func (*Encoder) SetVBRQuality

func (e *Encoder) SetVBRQuality(quality int)

func (*Encoder) SetWriteId3tagAutomatic

func (e *Encoder) SetWriteId3tagAutomatic(automaticWriteTag int)

func (*Encoder) SetbWriteVbrTag

func (e *Encoder) SetbWriteVbrTag(writeVbrTag int)

type Handle

type LameWriter

type LameWriter struct {
	Encoder          *Encoder
	EncodedChunkSize int
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(out io.Writer) *LameWriter

func (*LameWriter) Close

func (lw *LameWriter) Close() error

func (*LameWriter) Write

func (lw *LameWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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