Versions in this module Expand all Collapse all v0 v0.1.1 Dec 13, 2023 Changes in this version + var ErrCannotInitParams = errors.New("cannot init params, most likely invalid params, especially sample rates") + var ErrCannotReadChunkId = errors.New("cannot read chunkId") + var ErrCannotReadHeader = errors.New("cannot read headers") + var ErrEmptyArguments = errors.New("some arguments are empty") + var ErrInsufficientMemory = errors.New("cannot allocate memory for Lame") + var ErrInvalidSampleRate = errors.New("invalid sample rate, supports only 8, 12, 16, 22, 32, 44.1, 48k") + var ErrInvalidWavChunkId = errors.New("invalid wav chunk id, expected RIFF or RIFX") + var ErrParamsNotInit = errors.New("params not initialized") + var ErrTooSmallBuffer = errors.New("too small buffer") + var ErrUnknown = errors.New("unknown") + var ErrUnsupportedChannelNum = errors.New("only 1 and 2 channels are supported") + type AsmOptimizations int + const AO_AMD_3DNOW + const AO_INVALID + const AO_MMX + const AO_SSE + type EncodeOptions struct + InBigEndian bool + InBitsPerSample int + InNumChannels int + InSampleRate int + OutMode Mode + OutQuality int + OutSampleRate int + type Lame struct + func NewLame() (l *Lame, err error) + func (l *Lame) EncodeFlush() (residual []byte, err error) + func (l *Lame) EncodeInt16(dataLeft, dataRight []int16, mp3Buf []byte) (int, error) + func (l *Lame) EncodeInt16Interleaved(data []int16, mp3Buf []byte) (int, error) + func (l *Lame) EncodeInt32(dataLeft, dataRight []int32, mp3Buf []byte) (int, error) + func (l *Lame) EncodeInt64(dataLeft, dataRight []int32, mp3Buf []byte) (int, error) + func (l *Lame) GetATHlower() float32 + func (l *Lame) GetATHonly() int + func (l *Lame) GetATHshort() int + func (l *Lame) GetATHtype() int + func (l *Lame) GetAllowDiffShort() int + func (l *Lame) GetAnalysis() int + func (l *Lame) GetAthaaSensitivity() float32 + func (l *Lame) GetAthaaType() int + func (l *Lame) GetAudiophileGain() int + func (l *Lame) GetBWriteVbrTag() int + func (l *Lame) GetBrate() int + func (l *Lame) GetCompressionRatio() float32 + func (l *Lame) GetCopyright() int + func (l *Lame) GetDecodeOnTheFly() int + func (l *Lame) GetDecodeOnly() int + func (l *Lame) GetDisableReservoir() int + func (l *Lame) GetEmphasis() int + func (l *Lame) GetEncoderDelay() int + func (l *Lame) GetEncoderPadding() int + func (l *Lame) GetErrorProtection() int + func (l *Lame) GetExpNspsytune() int + func (l *Lame) GetExperimentalX() int + func (l *Lame) GetExperimentalY() int + func (l *Lame) GetExperimentalZ() int + func (l *Lame) GetExtension() int + func (l *Lame) GetFindReplayGain() int + func (l *Lame) GetForceMs() int + func (l *Lame) GetForceShortBlocks() int + func (l *Lame) GetFrameNum() int + func (l *Lame) GetFramesize() int + func (l *Lame) GetFreeFormat() int + func (l *Lame) GetHighpassfreq() int + func (l *Lame) GetHighpasswidth() int + func (l *Lame) GetInSampleRate() int + func (l *Lame) GetInterChRatio() float32 + func (l *Lame) GetLowpassfreq() int + func (l *Lame) GetLowpasswidth() int + func (l *Lame) GetMfSamplesToEncode() int + func (l *Lame) GetMode() Mode + func (l *Lame) GetMsfix() float32 + func (l *Lame) GetNoATH() int + func (l *Lame) GetNoShortBlocks() int + func (l *Lame) GetNoclipGainChange() int + func (l *Lame) GetNoclipScale() float32 + func (l *Lame) GetNogapCurrentindex() int + func (l *Lame) GetNogapTotal() int + func (l *Lame) GetNumChannels() int + func (l *Lame) GetOriginal() int + func (l *Lame) GetOutSampleRate() int + func (l *Lame) GetPeakSample() float32 + func (l *Lame) GetQuality() int + func (l *Lame) GetQuantComp() int + func (l *Lame) GetQuantCompShort() int + func (l *Lame) GetRadioGain() int + func (l *Lame) GetScale() float32 + func (l *Lame) GetScaleRight() float32 + func (l *Lame) GetSizeMp3buffer() int + func (l *Lame) GetStrictISO() int + func (l *Lame) GetTotalframes() int + func (l *Lame) GetUseTemporal() int + func (l *Lame) GetVBR() VBRMode + func (l *Lame) GetVBRHardMin() int + func (l *Lame) GetVBRMaxBitrateKbps() int + func (l *Lame) GetVBRMeanBitrateKbps() int + func (l *Lame) GetVBRMinBitrateKbps() int + func (l *Lame) GetVBRQ() int + func (l *Lame) GetVBRQuality() float32 + func (l *Lame) GetVersion() int + func (l *Lame) InitParams() error + func (l *Lame) SetATHlower(ATHlower float32) error + func (l *Lame) SetATHonly(ATHonly int) error + func (l *Lame) SetATHshort(ATHshort int) error + func (l *Lame) SetATHtype(ATHtype int) error + func (l *Lame) SetAllowDiffShort(allowDiffShort int) error + func (l *Lame) SetAnalysis(analysis int) error + func (l *Lame) SetAsmOptimizations(optim AsmOptimizations, mode int) error + func (l *Lame) SetAthaaSensitivity(athaaSensitivity float32) error + func (l *Lame) SetAthaaType(athaaType int) error + func (l *Lame) SetBWriteVbrTag(bWriteVbrTag int) error + func (l *Lame) SetBrate(brate int) error + func (l *Lame) SetCompressionRatio(compressionRatio float32) error + func (l *Lame) SetCopyright(copyright int) error + func (l *Lame) SetDecodeOnTheFly(decode_on_the_fly int) error + func (l *Lame) SetDecodeOnly(decodeOnly int) error + func (l *Lame) SetDisableReservoir(disable_reservoir int) error + func (l *Lame) SetEmphasis(emphasis int) error + func (l *Lame) SetErrorProtection(errorProtection int) error + func (l *Lame) SetExpNspsytune(expNspsytune int) error + func (l *Lame) SetExperimentalX(experimentalX int) error + func (l *Lame) SetExperimentalY(experimentalY int) error + func (l *Lame) SetExperimentalZ(experimentalZ int) error + func (l *Lame) SetExtension(extension int) error + func (l *Lame) SetFindReplayGain(findReplayGain int) error + func (l *Lame) SetForceMs(forceMs int) error + func (l *Lame) SetForceShortBlocks(forceShortBlocks int) error + func (l *Lame) SetFreeFormat(freeFormat int) error + func (l *Lame) SetHighpassfreq(highpassfreq int) error + func (l *Lame) SetHighpasswidth(highpasswidth int) error + func (l *Lame) SetInSampleRate(sampleRate int) error + func (l *Lame) SetInterChRatio(interChRatio float32) error + func (l *Lame) SetLowpassfreq(lowpassfreq int) error + func (l *Lame) SetLowpasswidth(lowpasswidth int) error + func (l *Lame) SetMode(mode Mode) error + func (l *Lame) SetMsfix(msfix float32) + func (l *Lame) SetNoATH(noATH int) error + func (l *Lame) SetNoShortBlocks(noShortBlocks int) error + func (l *Lame) SetNogapCurrentindex(nogapCurrentindex int) error + func (l *Lame) SetNogapTotal(nogapTotal int) error + func (l *Lame) SetNumChannels(numChannels int) error + func (l *Lame) SetOriginal(original int) error + func (l *Lame) SetOutSampleRate(outSampleRate int) error + func (l *Lame) SetPreset(preset int) error + func (l *Lame) SetQuality(quality int) error + func (l *Lame) SetQuantComp(quantComp int) error + func (l *Lame) SetQuantCompShort(quantCompShort int) error + func (l *Lame) SetScale(scale float32) error + func (l *Lame) SetScaleLeft(scale float32) error + func (l *Lame) SetScaleRight(scaleRight float32) error + func (l *Lame) SetStrictISO(strictISO int) error + func (l *Lame) SetUseTemporal(useTemporal int) error + func (l *Lame) SetVBR(vbr VBRMode) error + func (l *Lame) SetVBRHardMin(VBRHardMin int) error + func (l *Lame) SetVBRMaxBitrateKbps(VBRMaxBitrateKbps int) error + func (l *Lame) SetVBRMeanBitrateKbps(VBRMeanBitrateKbps int) error + func (l *Lame) SetVBRMinBitrateKbps(VBRMinBitrateKbps int) error + func (l *Lame) SetVBRQ(VBR_q int) error + func (l *Lame) SetVBRQuality(VBRQuality float32) error + type Mode int + const MODE_DUAL_CHANNEL + const MODE_JOINT_STEREO + const MODE_MAX_INDICATOR + const MODE_MONO + const MODE_NOT_SET + const MODE_STEREO + type VBRMode int + const VBR_ABR + const VBR_DEFAULT + const VBR_MAX_INDICATOR + const VBR_MT + const VBR_MTRH + const VBR_OFF + const VBR_RH + type WavHeader struct + ChunkId [4]byte + func ReadWavHeader(reader io.Reader) (hdr *WavHeader, err error) + func (hdr *WavHeader) IsBigEndian() bool + func (hdr *WavHeader) ToEncodeOptions() EncodeOptions + type WavHeaderRemaining struct + AudioFormat int16 + BitsPerSample int16 + BlockAlign int16 + ByteRate int32 + ChunkSize int32 + Format [4]byte + NumChannels int16 + SampleRate int32 + SubChunk1Id [4]byte + SubChunk1Size int32 + SubChunk2Id [4]byte + SubChunk2Size int32 + type Writer struct + func NewWriter(output io.Writer) (*Writer, error) + func (w *Writer) Close() error + func (w *Writer) ForceUpdateParams() (err error) + func (w *Writer) Write(p []byte) (n int, err error)