public class LAMEHeader
extends java.lang.Object
The LAME header is an extension of the Xing
header and is found in variable bit rate
encoded .mp3 files.
It is an optional header, and if present, will be found within the first MPEG audio frame directly following the Xing header
.
When the LAME header was first added in the LAME 3.12 encoder, it consisted of 20 bytes, with only the first 9 bytes being used
for a version string. In LAME 3.90, the lame tag was expanded to include additional information, and expanded again in version 3.94. It is in version 3.94 that the Lame
encoder started adding the Xing/LAME headers to constant bit rate
encoded .mp3s, albeit with the Xing header
id being set to "Info" instead of "Xing". All of this is explained in the VBR header and LAME tag
article.
Modifier and Type | Field and Description |
---|---|
static int |
HEADER_MAX_SIZE
LAME headers after version 3.90 were 36 bytes long
|
static int |
HEADER_MIN_SIZE
LAME headers prior to version 3.90 were 20 bytes long
|
Constructor and Description |
---|
LAMEHeader()
default constructor.
|
LAMEHeader(byte[] bytes,
int index)
constructor.
|
LAMEHeader(java.io.InputStream inputStream)
constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getAthType()
get the ATH type.
|
ReplayGain |
getAudiophileReplayGain()
get the gain (volume) setting specified by the user for playing the .mp3 file.
|
int |
getBitrate()
get the bit rate used to encode the .mp3 file.
|
byte[] |
getCRC()
get the 16 bit CRC value of the first 190 bytes of the Info header frame.
|
int |
getEncodingDelay()
get the number of samples of silence added to the begining of the .mp3 file
|
int |
getEncodingPadding()
get the number of samples of silence added to the end of the .mp3 file
|
java.lang.String |
getId()
get the LAME header id;
|
int |
getLowpassFilterFrequency()
get the low pass filter frequency (in hz) setting used by the LAME encoder to encode the .mp3 file.
|
byte |
getMp3Gain()
get the gain byte used by tools like mp3 Gain to normalize volumes for mp3's.
|
byte[] |
getMusicCRC()
get the 16 bit CRC value of the complete .mp3 music data as originally made by LAME.
|
int |
getMusicLength()
get length (in bytes) from the LAME header to the last byte of the last mpeg audio frame.
|
int |
getNoiseShaping()
get type of noise shaping used to encode the .mp3 file.
|
float |
getPeakSignalAmplitude()
get the peak signal amplitude that occurs in the digital audio samples in this frame.
|
int |
getPreset()
get the preset used internally by the LAME encoder/decoder as an index into an internal LAME preset enum.
|
ReplayGain |
getRadioReplayGain()
get the gain (volume) setting specified for playing the .mp3 file on the radio.
|
int |
getRevision()
get the LAME header revision;
|
int |
getSize()
gets the size (in bytes) of the LAME header.
|
SourceFrequency |
getSourceSampleFrequency()
get the original audio source's sample frequency (in hz).
|
StereoMode |
getStereoMode()
get the stereo mode used to encode the .mp3 file.
|
SurroundInfo |
getSurroundInfo()
get the surround info.
|
VBRMethod |
getVBRMethod()
get the bit rate encoding method used to encode the .mp3 file.
|
Version |
getVersion()
get the LAME header version;
|
java.lang.String |
toString()
get a string representation of the LAME header.
|
boolean |
usedNoGapNext()
get whether the .mp3 file was encoded by the LAME encoder with the --nogap option.
|
boolean |
usedNoGapPrevious()
get whether the .mp3 file was encoded by the LAME encoder with the --nogap option.
|
boolean |
usedPsytune()
get whether the .mp3 file was encoded by the LAME encoder with the --nspsytune option.
|
boolean |
usedSafejoint()
get whether the .mp3 file was encoded by the LAME encoder with the --nssafejoint option.
|
boolean |
usedUnwise()
get whether the user used some settings which would likely damage quality in normal circumstances.
|
public static final int HEADER_MIN_SIZE
public static final int HEADER_MAX_SIZE
public LAMEHeader()
public LAMEHeader(java.io.InputStream inputStream) throws java.io.IOException, ParseException
inputStream
- input stream pointing to the LAME header in an mpeg audio frame in an .mp3 file.java.io.IOException
- if there is an error while reading the LAME header from the .mp3 file.ParseException
- if an invalid value is detected while parsing the LAME header's raw bytes.public LAMEHeader(byte[] bytes, int index) throws ParseException
bytes
- the raw bytes of an MPEG audio frame.index
- the offset into the bytes of the MPEG audio frame where the LAME header begins.ParseException
- if an invalid value is detected while parsing the LAME header's raw bytes.public java.lang.String getId()
public Version getVersion()
public int getRevision()
public VBRMethod getVBRMethod()
public int getLowpassFilterFrequency()
public float getPeakSignalAmplitude()
public ReplayGain getRadioReplayGain()
public ReplayGain getAudiophileReplayGain()
public int getAthType()
public boolean usedPsytune()
public boolean usedSafejoint()
public boolean usedNoGapNext()
public boolean usedNoGapPrevious()
public int getBitrate()
public int getEncodingDelay()
public int getEncodingPadding()
public int getNoiseShaping()
public StereoMode getStereoMode()
public boolean usedUnwise()
public SourceFrequency getSourceSampleFrequency()
public byte getMp3Gain()
public SurroundInfo getSurroundInfo()
public int getPreset()
public int getMusicLength()
public byte[] getMusicCRC()
public byte[] getCRC()
public int getSize()
public java.lang.String toString()
toString
in class java.lang.Object