BASS.NET API for the Un4seen BASS Audio LibraryEncoderLAME ClassBASS.NET API for the Un4seen BASS Audio Library
Encoder class implementation for MP3 encoding using lame.exe.
Inheritance Hierarchy

SystemObject
  Un4seen.Bass.MiscBaseEncoder
    Un4seen.Bass.MiscEncoderLAME

Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[SerializableAttribute]
public class EncoderLAME : BaseEncoder

The EncoderLAME type exposes the following members.

Constructors

  NameDescription
Public methodEncoderLAME
Creates an instance of a LAME encoder implementation.
Top
Properties

  NameDescription
Public propertyChannelBitwidth
This property returns the actual bitwidth of the sample data of the channel (e.g. 8, 16, 32).
(Inherited from BaseEncoder.)
Public propertyChannelHandle
Gets or Sets the channel handle which is used to create the broadcast encoder class.
(Inherited from BaseEncoder.)
Public propertyChannelInfo
Returns the general channel info.
(Inherited from BaseEncoder.)
Public propertyChannelNumChans
This property returns the actual number of channles of the sample data BASS is using with the channel (e.g. 1=mono, 2=stereo, etc.).
(Inherited from BaseEncoder.)
Public propertyChannelSampleRate
This property returns the actual sample rate in Hz of the sample data BASS is using with the channel (e.g. 44100).
(Inherited from BaseEncoder.)
Public propertyDefaultOutputExtension
This return the default extension of an output file for this encoder (".mp3").
(Overrides BaseEncoderDefaultOutputExtension.)
Public propertyEffectiveBitrate
Returns the effective encoder bitrate (in kbps) of the output.
(Overrides BaseEncoderEffectiveBitrate.)
Public propertyEncoderCommandLine
Gets the actual encoder command-line string (using all LAME_xxx properties).
(Overrides BaseEncoderEncoderCommandLine.)
Public propertyEncoderDirectory
Gets or Sets the encoder's base directory.
(Inherited from BaseEncoder.)
Public propertyEncoderExists
This property return , if the file "lame.exe" exists in the EncoderDirectory - else is returned.
(Overrides BaseEncoderEncoderExists.)
Public propertyEncoderHandle
Gets or sets the current HENCODE encoder handle.
(Inherited from BaseEncoder.)
Public propertyEncoderType
Gets a value indicating the type of content. Here BASS_CTYPE_STREAM_MP3 is always returned.
(Overrides BaseEncoderEncoderType.)
Public propertyForce16Bit
Gets or Sets if a encoding in 16-bit sample data should be forced (default is ).
(Inherited from BaseEncoder.)
Public propertyInputFile
Gets or Sets the input file name to be processed by the encoder (null = STDIN, default).
(Inherited from BaseEncoder.)
Public propertyIsActive
Gets a value indicating if the encoder has been started (see Start(ENCODEPROC, IntPtr, Boolean)) and is active - else will be returned.
(Inherited from BaseEncoder.)
Public propertyIsPaused
Gets a value indicating if the encoder has been paused (see Pause(Boolean)) - else must be returned.
(Inherited from BaseEncoder.)
Public propertyNoLimit
Gets or Sets if encoding should use the CAST_NOLIMIT flag (which is only needed, if the encoder is used for streaming).
(Inherited from BaseEncoder.)
Public propertyOutputFile
Gets or Sets the output file name to be processed by the encoder (null = STDOUT, default).
(Inherited from BaseEncoder.)
Public propertySupportsSTDOUT
LAME implements STDOUT, so is always returned.
(Overrides BaseEncoderSupportsSTDOUT.)
Public propertyTAGs
Gets or Sets the TAG_INFO structure associated with the encoder.
(Inherited from BaseEncoder.)
Public propertyUseAsyncQueue
Gets or Sets if encoding should use an async queue (i.e. the BASS_ENCODE_QUEUE flag).
(Inherited from BaseEncoder.)
Top
Methods

  NameDescription
Public methodDispose
Implement IDisposable.
(Inherited from BaseEncoder.)
Protected methodFinalize
Finalization code.
(Inherited from BaseEncoder.)
Public methodPause
Pauses or resumes an encoder.
(Inherited from BaseEncoder.)
Public methodSettingsString
Returns the string representation of the current encoder settings.
(Overrides BaseEncoderSettingsString.)
Public methodStart
This method starts the actual LAME encoder.
(Overrides BaseEncoderStart(ENCODEPROC, IntPtr, Boolean).)
Public methodStop
Stops the encoder (if started).
(Inherited from BaseEncoder.)
Public methodStop(Boolean)
Stops the encoder (if started).
(Inherited from BaseEncoder.)
Public methodToString
Returns the name of the Encoder.
(Overrides ObjectToString.)
Top
Fields

  NameDescription
Public fieldLAME_ABRBitrate
--abr: Specify average target bitrate in kbps desired (instead of quality). Set to 0, if this option should be disabled (default).
Public fieldLAME_ATHControl
--ath...: ATH control.
Public fieldLAME_Bitrate
-b: Constant (or minimum allowed) bitrate in kbps, default 128 kbps.
Public fieldLAME_Copyright
-c: mark as copyright (default=).
Public fieldLAME_CustomOptions
The custom parameter string, which should be used, if the LAME_UseCustomOptionsOnly property is set to .
Public fieldLAME_DisableAllFilters
-k: keep ALL frequencies (disables all filters), can cause ringing and twinkling (default=).
Public fieldLAME_DisableBitReservoir
--nores: disable the bit reservoir (default=).
Public fieldLAME_EnforceCBR
--cbr: Enforce use of constant bitrate.
Public fieldLAME_EnforceISO
--strictly-enforce-ISO: comply as much as possible to ISO MPEG spec (default=).
Public fieldLAME_FreeFormat
--freeformat: produce a free format bitstream? (Default is ).
Public fieldLAME_HighPassFreq
--highpass: frequency(kHz), highpass filter cutoff below freq.
Public fieldLAME_HighPassFreqWidth
--highpass-width: frequency(kHz) - default 15% of highpass freq.
Public fieldLAME_LimitVBR
Use variable bitrate (VBR) limitation (Default is ).
Public fieldLAME_LowPassFreq
--lowpass: frequency(kHz), lowpass filter cutoff above freq.
Public fieldLAME_LowPassFreqWidth
--lowpass-width: frequency(kHz) - default 15% of lowpass freq.
Public fieldLAME_Mode
-m: The encoding mode (stereo, joint stereo, mono etc.).
Public fieldLAME_NoASM
--noasm: disable assembly optimizations for mmx/3dnow/sse.
Public fieldLAME_NonOriginal
-o: mark as non-original (default=).
Public fieldLAME_PresetName
--preset: Preset name must be "medium", "standard", "extreme", "insane" or a value for an average desired bitrate and depending on the value specified, appropriate quality settings will be used.
Public fieldLAME_Protect
-p: error protection. Adds 16-bit checksum to every frame (default=).
Public fieldLAME_PSYallShortBlocks
--allshort: use only short blocks (default=).
Public fieldLAME_PSYnoShortBlocks
--noshort: don't use short blocks (default=).
Public fieldLAME_PSYnoTemp
--notemp: disable temporal masking effect (default=).
Public fieldLAME_PSYnsSafeJoint
--nssafejoint: M/S switching criterion (default=).
Public fieldLAME_PSYuseShortBlocks
--short: use short blocks when appropriate (default=).
Public fieldLAME_Quality
Noise shaping and psycho acoustic algorithms (default is Quality).
Public fieldLAME_ReplayGain
--replaygain: ReplayGain analysis (Default is None).
Public fieldLAME_Scale
--scale: Scale input (multiply PCM data). Set to 1.00 (default) for no scaling.
Public fieldLAME_TargetSampleRate
--resample: target sampling frequency of output (in Hz). Set to 0 (zero) to use automatic resampling (default).
Public fieldLAME_UseCustomOptionsOnly
Use the LAME_CustomOptions parameter string only (default=).
Public fieldLAME_UseVBR
Use variable bitrate (VBR) (Default is ).
Public fieldLAME_VBRDisableTag
-t: disable writing VBR LAME Tag? (Default is ).
Public fieldLAME_VBREnforceMinBitrate
-F: strictly enforce minimum bitrate, for use with players that do not support low bitrate mp3.
Public fieldLAME_VBRMaxBitrate
Specify maximum allowed bitrate in kbps, default 320 kbps.
Public fieldLAME_VBRQuality
-V: Quality setting for VBR (default is VBR_Q4).
Top
Remarks

This class uses the BASS_CTYPE_STREAM_MP3 encoder type.

LAME (lame.exe) must be downloaded separately (e.g. from www.rarewares.org).

Since lame.exe does not support 32-bit IEEE float sample data as input, the BASS_ENCODE_FP_32BIT will be used for highest quality. This will be used, whenever the underlying channel handle is 32-bit float or the BASS_CONFIG_FLOATDSP option has been set.

Make sure to set the LAME_xxx flags before retrieving the EncoderCommandLine or calling Start(ENCODEPROC, IntPtr, Boolean).

This implementation uses the automatic DSP system for encoding. Meaning the sending of sample data to the encoder is done automatically when you play the channel (BASS_ChannelPlay(Int32, Boolean)) or call BASS_ChannelGetData(Int32, IntPtr, Int32) (if it's a decoding channel). So there is no need to call BASS_Encode_Write(Int32, IntPtr, Int32) manually!

If you simply want to encode a physical file please also take a look to the EncodeFile(String, String, BaseEncoder, BaseEncoderENCODEFILEPROC, Boolean, Boolean).

See Also

Reference