Documentation ¶
Index ¶
- type Encoder
- func (e *Encoder) Brate() int
- func (e *Encoder) Close()
- func (e *Encoder) Flush() (n int, err error)
- func (e *Encoder) HighPassFrequency() int
- func (e *Encoder) HighPassWidth() int
- func (e *Encoder) ID3TagAddV2()
- func (e *Encoder) ID3TagPadV2()
- func (e *Encoder) ID3TagSetAlbum(value string)
- func (e *Encoder) ID3TagSetArtist(value string)
- func (e *Encoder) ID3TagSetComment(value string)
- func (e *Encoder) ID3TagSetGenre(value string) error
- func (e *Encoder) ID3TagSetPad(n int)
- func (e *Encoder) ID3TagSetTitle(value string)
- func (e *Encoder) ID3TagSetTrack(value string) error
- func (e *Encoder) ID3TagSetYear(value string)
- func (e *Encoder) ID3TagSpaceV1()
- func (e *Encoder) ID3TagV1Only()
- func (e *Encoder) ID3TagV2Only()
- func (e *Encoder) ID3V1Tag() []byte
- func (e *Encoder) ID3V2Tag() []byte
- func (e *Encoder) InSamplerate() int
- func (e *Encoder) InitID3Tag()
- func (e *Encoder) LameTagFrame() []byte
- func (e *Encoder) LowPassFrequency() int
- func (e *Encoder) LowPassWidth() int
- func (e *Encoder) NumChannels() int
- func (e *Encoder) NumSamples() uint32
- func (e *Encoder) Quality() int
- func (e *Encoder) SetBrate(brate int) error
- func (e *Encoder) SetHighPassFrequency(frequency int) error
- func (e *Encoder) SetHighPassWidth(frequency int) error
- func (e *Encoder) SetInSamplerate(sampleRate int) error
- func (e *Encoder) SetLowPassFrequency(frequency int) error
- func (e *Encoder) SetLowPassWidth(frequency int) error
- func (e *Encoder) SetMode(mode MpegMode) error
- func (e *Encoder) SetNumChannels(num int) error
- func (e *Encoder) SetNumSamples(numSamples uint32) error
- func (e *Encoder) SetQuality(quality int) error
- func (e *Encoder) SetVBR(mode VBRMode) error
- func (e *Encoder) SetVBRHardMin(enforce bool) error
- func (e *Encoder) SetVBRMaxBitrateKbps(kbps int) error
- func (e *Encoder) SetVBRMeanBitrateKbps(kbps int) error
- func (e *Encoder) SetVBRMinBitrateKbps(kbps int) error
- func (e *Encoder) SetVBRQuality(quality float64) error
- func (e *Encoder) SetWriteID3TagAutomatic(auto bool)
- func (e *Encoder) VBRHardMin() bool
- func (e *Encoder) VBRMaxBitrateKbps() int
- func (e *Encoder) VBRMeanBitrateKbps() int
- func (e *Encoder) VBRMinBitrateKbps() int
- func (e *Encoder) Write(p []byte) (int, error)
- func (e *Encoder) WriteID3TagAutomatic() bool
- type Error
- type MpegMode
- type PaddingType
- type PresetMode
- type VBRMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder represents a Writer interface to lame encoder
func (*Encoder) Close ¶
func (e *Encoder) Close()
Close closes the encoder if it's not closed yet Note that encoder is being closed automatically on GC
func (*Encoder) HighPassFrequency ¶
HighPassFrequency returns current highpass frequency value
func (*Encoder) HighPassWidth ¶
HighPassWidth returns current highpass width value
func (*Encoder) ID3TagAddV2 ¶
func (e *Encoder) ID3TagAddV2()
ID3TagAddV2 forces addition of version 2 tag
func (*Encoder) ID3TagPadV2 ¶
func (e *Encoder) ID3TagPadV2()
ID3TagPadV2 pads version 2 tag with extra 128 bytes
func (*Encoder) ID3TagSetAlbum ¶
ID3TagSetAlbum sets id3 album
func (*Encoder) ID3TagSetArtist ¶
ID3TagSetArtist sets id3 artist
func (*Encoder) ID3TagSetComment ¶
ID3TagSetComment sets id3 comment
func (*Encoder) ID3TagSetGenre ¶
ID3TagSetGenre sets id3 genre
func (*Encoder) ID3TagSetPad ¶
ID3TagSetPad pads version 2 tag with extra n bytes
func (*Encoder) ID3TagSetTitle ¶
ID3TagSetTitle sets id3 title
func (*Encoder) ID3TagSetTrack ¶
ID3TagSetTrack sets id3 track
note that lame accepts a string and returns an error if track value is out of range
func (*Encoder) ID3TagSetYear ¶
ID3TagSetYear sets id3 year
func (*Encoder) ID3TagSpaceV1 ¶
func (e *Encoder) ID3TagSpaceV1()
ID3TagSpaceV1 sets version 1 tag padding with spaces instead of nulls
func (*Encoder) ID3TagV1Only ¶
func (e *Encoder) ID3TagV1Only()
ID3TagV1Only sets addition of only a version 1 tag
func (*Encoder) ID3TagV2Only ¶
func (e *Encoder) ID3TagV2Only()
ID3TagV2Only sets addition of only a version 2 tag
func (*Encoder) InSamplerate ¶
InSamplerate returns current input sample rate configured
func (*Encoder) LameTagFrame ¶
LameTagFrame returns the final LAME-tag frame
- NOTE:
- if VBR tags are turned off by the user, or turned off by LAME,
- this call does nothing and returns 0.
- NOTE:
- LAME inserted an empty frame in the beginning of mp3 audio data,
- which you have to replace by the final LAME-tag frame after encoding.
- In case there is no ID3v2 tag, usually this frame will be the very first
- data in your mp3 file. If you put some other leading data into your
- file, you'll have to do some bookkeeping about where to write this buffer.
func (*Encoder) LowPassFrequency ¶
LowPassFrequency returns current lowpass frequency value
func (*Encoder) LowPassWidth ¶
LowPassWidth returns current lowpass width value
func (*Encoder) NumChannels ¶
NumChannels returns current input numchannels value
func (*Encoder) NumSamples ¶
NumSamples gets number of samples
func (*Encoder) SetBrate ¶
SetBrate sets one of brate compression ratio.
default is compression ratio of 11
func (*Encoder) SetHighPassFrequency ¶
SetHighPassFrequency applies lowpass filtering to frequency in Hz
0 - lame chooses -1 - disable lowpass default is 0
func (*Encoder) SetHighPassWidth ¶
SetHighPassWidth sets the width of transition band in Hz
default = one polyphase filter band
func (*Encoder) SetLowPassFrequency ¶
SetLowPassFrequency applies lowpass filtering to frequency in Hz
0 - lame chooses -1 - disable lowpass default is 0
func (*Encoder) SetLowPassWidth ¶
SetLowPassWidth sets the width of transition band in Hz
default = one polyphase filter band
func (*Encoder) SetMode ¶
SetMode sets output audio mode
mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono default: lame picks based on compression ration and input channels
func (*Encoder) SetNumChannels ¶
SetNumChannels sets number of channels in input stream
default is 2
func (*Encoder) SetQuality ¶
SetQuality chooses internal algorithm selection.
True quality is determined by the bitrate but this variable will effect quality by selecting expensive or cheap algorithms. quality=0..9. 0=best (very slow). 9=worst. recommended: 2 near-best quality, not too slow 5 good quality, fast 7 ok quality, really fast
func (*Encoder) SetVBRHardMin ¶
SetVBRHardMin when enforce==true, strictly enforces min bitrate
Normally it will be violated for analog silence
func (*Encoder) SetVBRMaxBitrateKbps ¶
SetVBRMaxBitrateKbps sets max bitrate
Ignored unless VBRABR mode is used
func (*Encoder) SetVBRMeanBitrateKbps ¶
SetVBRMeanBitrateKbps sets VBR mean bitrate
Ignored unless VBRABR mode is used
func (*Encoder) SetVBRMinBitrateKbps ¶
SetVBRMinBitrateKbps sets min bitrate I gnored unless VBRABR mode is used
func (*Encoder) SetVBRQuality ¶
SetVBRQuality sets VBR quality level. 0=highest 9=lowest, Range [0,...,10[
func (*Encoder) SetWriteID3TagAutomatic ¶
SetWriteID3TagAutomatic sets automatic write of id3 tag
Normaly lame_init_param writes ID3v2 tags into the audio stream. Here in Encoder lame_init_param is launched on first write to encoder instance. Call SetWriteID3TagAutomatic(false) before writing to encoder to turn off this behaviour and get ID3v2 tag with above function write it yourself into your file.
func (*Encoder) VBRHardMin ¶
VBRHardMin returns enforced min bitrate value
func (*Encoder) VBRMaxBitrateKbps ¶
VBRMaxBitrateKbps returns VBR mean bitrate
func (*Encoder) VBRMeanBitrateKbps ¶
VBRMeanBitrateKbps returns VBR mean bitrate
func (*Encoder) VBRMinBitrateKbps ¶
VBRMinBitrateKbps returns VBR mean bitrate
func (*Encoder) WriteID3TagAutomatic ¶
WriteID3TagAutomatic returns current automatic tag write flag
type Error ¶
type Error int
Error lame error type
type MpegMode ¶
type MpegMode int
MpegMode is a MPEG mode constants type
const ( MpegStereo MpegMode = C.STEREO MpegJointStereo MpegMode = C.JOINT_STEREO MpegDualChannel MpegMode = C.DUAL_CHANNEL /* LAME doesn't supports this! */ MpegMono MpegMode = C.MONO MpegNotSet MpegMode = C.NOT_SET MpegMaxIndicator MpegMode = C.MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ )
MPEG modes
type PaddingType ¶
type PaddingType int
PaddingType is a padding type constants type
const ( PadNo PaddingType = C.PAD_NO PadAll PaddingType = C.PAD_ALL PadAdjust PaddingType = C.PAD_ADJUST PadMaxIndicator PaddingType = C.PAD_MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ )
Padding types
type PresetMode ¶
type PresetMode int
PresetMode is a preset mode constants type
const ( PresetABR8 PresetMode = C.ABR_8 PresetABR320 PresetMode = C.ABR_320 PresetV9 PresetMode = C.V9 PresetVBR10 PresetMode = C.VBR_10 PresetV8 PresetMode = C.V8 PresetVBR20 PresetMode = C.VBR_20 PresetV7 PresetMode = C.V7 PresetVBR30 PresetMode = C.VBR_30 PresetV6 PresetMode = C.V6 PresetVBR40 PresetMode = C.VBR_40 PresetV5 PresetMode = C.V5 PresetVBR50 PresetMode = C.VBR_50 PresetV4 PresetMode = C.V4 PresetVBR60 PresetMode = C.VBR_60 PresetV3 PresetMode = C.V3 PresetVBR70 PresetMode = C.VBR_70 PresetV2 PresetMode = C.V2 PresetVBR80 PresetMode = C.VBR_80 PresetV1 PresetMode = C.V1 PresetVBR90 PresetMode = C.VBR_90 PresetV0 PresetMode = C.V0 PresetVBR100 PresetMode = C.VBR_100 // Compatibility presets PresetR3Mix PresetMode = C.R3MIX PresetStandard PresetMode = C.STANDARD PresetExtreme PresetMode = C.EXTREME PresetInsane PresetMode = C.INSANE PresetStandardFast PresetMode = C.STANDARD_FAST PresetExtremeFast PresetMode = C.EXTREME_FAST PresetMedium PresetMode = C.MEDIUM PresetMediumFast PresetMode = C.MEDIUM_FAST )
Preset modes
type VBRMode ¶
type VBRMode int
VBRMode is a VBR mode constants type
const ( VBROff VBRMode = C.vbr_off VBRMT VBRMode = C.vbr_mt /* obsolete, same as vbr_mtrh */ VBRRH VBRMode = C.vbr_rh VBRABR VBRMode = C.vbr_abr VBRMTRH VBRMode = C.vbr_mtrh VBRMaxIndicator VBRMode = C.vbr_max_indicator /* Don't use this! It's used for sanity checks. */ VBRDefault VBRMode = C.vbr_default )
VBR modes