| java.lang.Object com.db.media.audio.AudioConversionTool
AudioConversionTool | public class AudioConversionTool (Code) | | Useful methods for converting audio data.
|
Method Summary | |
public static short | alaw2linear(byte ulawbyte) | public static void | alaw2pcm16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) Fills outBuffer with pcm signed 16 bit samples. | public static void | alaw2pcm8(byte[] buffer, int byteOffset, int sampleCount, boolean signed) Converts an alaw buffer to 8bit pcm samples
The 8bit bytes overwrite the original alaw values. | public static void | alaw2pcm8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) Fills outBuffer with alaw samples. | public static byte | alaw2ulaw(byte sample) | public static void | alaw2ulaw(byte[] buffer, int byteOffset, int sampleCount) Converts a buffer of aLaw samples to uLaw. | public static void | alaw2ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) Fills outBuffer with ulaw samples. | public static int | bytesToInt16(byte highByte, byte lowByte) Converts 2 bytes to a signed integer sample with 16bit range. | public static int | bytesToInt16(byte[] buffer, int byteOffset, boolean bigEndian) Converts 2 successive bytes starting at byteOffset in
buffer to a signed integer sample with 16bit range. | public static int | bytesToInt24(byte[] buffer, int byteOffset, boolean bigEndian) Converts 3 successive bytes starting at byteOffset in
buffer to a signed integer sample with 24bit range. | public static int | bytesToInt32(byte[] buffer, int byteOffset, boolean bigEndian) Converts a 4 successive bytes starting at byteOffset in
buffer to a signed 32bit integer sample. | public static short | bytesToShort16(byte highByte, byte lowByte) Converts 2 bytes to a signed sample of type short . | public static short | bytesToShort16(byte[] buffer, int byteOffset, boolean bigEndian) Converts 2 successive bytes starting at byteOffset in
buffer to a signed sample of type short . | public static void | changeOrderOrSign(byte[] buffer, int nOffset, int nByteLength, int nBytesPerSample) | public static void | changeOrderOrSign(byte[] inBuffer, int nInOffset, byte[] outBuffer, int nOutOffset, int nByteLength, int nBytesPerSample) | public static void | convertSign8(byte[] buffer, int byteOffset, int sampleCount) | public static void | convertSign8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) | public static void | intToBytes16(int sample, byte[] buffer, int byteOffset, boolean bigEndian) Converts a 16 bit sample of type int to 2 bytes in an array. | public static void | intToBytes24(int sample, byte[] buffer, int byteOffset, boolean bigEndian) Converts a 24 bit sample of type int to 3 bytes in an array. | public static void | intToBytes32(int sample, byte[] buffer, int byteOffset, boolean bigEndian) Converts a 32 bit sample of type int to 4 bytes in an array. | public static byte | linear2alaw(short pcm_val) | public static byte | linear2ulaw(int sample) Converts a linear signed 16bit sample to a uLaw byte. | public static void | pcm162alaw(byte[] buffer, int byteOffset, int sampleCount, boolean bigEndian) Converts a buffer of signed 16bit big endian samples to uLaw. | public static void | pcm162alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) Fills outBuffer with alaw samples. | public static void | pcm162ulaw(byte[] buffer, int byteOffset, int sampleCount, boolean bigEndian) Converts a buffer of signed 16bit big endian samples to uLaw. | public static void | pcm162ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) Fills outBuffer with ulaw samples. | public static void | pcm82alaw(byte[] buffer, int byteOffset, int sampleCount, boolean signed) Converts a buffer of 8bit samples to alaw. | public static void | pcm82alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) Fills outBuffer with alaw samples. | public static void | pcm82ulaw(byte[] buffer, int byteOffset, int sampleCount, boolean signed) Converts a buffer of 8bit samples to uLaw. | public static void | pcm82ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) Fills outBuffer with ulaw samples. | public static void | shortToBytes16(short sample, byte[] buffer, int byteOffset, boolean bigEndian) Converts a sample of type short to 2 bytes in an array. | public static void | swapOrder16(byte[] buffer, int byteOffset, int sampleCount) | public static void | swapOrder16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) | public static void | swapOrder24(byte[] buffer, int byteOffset, int sampleCount) | public static void | swapOrder24(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) | public static void | swapOrder32(byte[] buffer, int byteOffset, int sampleCount) | public static void | swapOrder32(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) | public static byte | ulaw2alaw(byte sample) | public static void | ulaw2alaw(byte[] buffer, int byteOffset, int sampleCount) Converts a buffer of uLaw samples to aLaw. | public static void | ulaw2alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) Fills outBuffer with alaw samples. | public static short | ulaw2linear(byte ulawbyte) | public static void | ulaw2pcm16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) Fills outBuffer with pcm signed 16 bit samples. | public static void | ulaw2pcm8(byte[] buffer, int byteOffset, int sampleCount, boolean signed) Inplace-conversion of a ulaw buffer to 8bit samples. | public static void | ulaw2pcm8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) Fills outBuffer with ulaw samples. |
alaw2linear | public static short alaw2linear(byte ulawbyte)(Code) | | |
alaw2pcm16 | public static void alaw2pcm16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian)(Code) | | Fills outBuffer with pcm signed 16 bit samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes read from inBuffer;
There will be sampleCount*2 bytes written to outBuffer.
|
alaw2pcm8 | public static void alaw2pcm8(byte[] buffer, int byteOffset, int sampleCount, boolean signed)(Code) | | Converts an alaw buffer to 8bit pcm samples
The 8bit bytes overwrite the original alaw values.
The first byte-offset of the aLaw bytes is byteOffset.
It will be written sampleCount bytes.
|
alaw2pcm8 | public static void alaw2pcm8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed)(Code) | | Fills outBuffer with alaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes written to outBuffer.
|
alaw2ulaw | public static byte alaw2ulaw(byte sample)(Code) | | |
alaw2ulaw | public static void alaw2ulaw(byte[] buffer, int byteOffset, int sampleCount)(Code) | | Converts a buffer of aLaw samples to uLaw.
The uLaw bytes overwrite the original aLaw values.
The first byte-offset of the uLaw bytes is byteOffset.
It will be written sampleCount bytes.
|
alaw2ulaw | public static void alaw2ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount)(Code) | | Fills outBuffer with ulaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes written to outBuffer.
|
bytesToInt16 | public static int bytesToInt16(byte highByte, byte lowByte)(Code) | | Converts 2 bytes to a signed integer sample with 16bit range.
This is a reference function.
|
bytesToInt16 | public static int bytesToInt16(byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts 2 successive bytes starting at byteOffset in
buffer to a signed integer sample with 16bit range.
For little endian, buffer[byteOffset] is interpreted as low byte,
whereas it is interpreted as high byte in big endian.
This is a reference function.
|
bytesToInt24 | public static int bytesToInt24(byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts 3 successive bytes starting at byteOffset in
buffer to a signed integer sample with 24bit range.
For little endian, buffer[byteOffset] is interpreted as lowest byte,
whereas it is interpreted as highest byte in big endian.
This is a reference function.
|
bytesToInt32 | public static int bytesToInt32(byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts a 4 successive bytes starting at byteOffset in
buffer to a signed 32bit integer sample.
For little endian, buffer[byteOffset] is interpreted as lowest byte,
whereas it is interpreted as highest byte in big endian.
This is a reference function.
|
bytesToShort16 | public static short bytesToShort16(byte highByte, byte lowByte)(Code) | | Converts 2 bytes to a signed sample of type short .
This is a reference function.
|
bytesToShort16 | public static short bytesToShort16(byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts 2 successive bytes starting at byteOffset in
buffer to a signed sample of type short .
For little endian, buffer[byteOffset] is interpreted as low byte,
whereas it is interpreted as high byte in big endian.
This is a reference function.
|
changeOrderOrSign | public static void changeOrderOrSign(byte[] buffer, int nOffset, int nByteLength, int nBytesPerSample)(Code) | | |
changeOrderOrSign | public static void changeOrderOrSign(byte[] inBuffer, int nInOffset, byte[] outBuffer, int nOutOffset, int nByteLength, int nBytesPerSample)(Code) | | |
convertSign8 | public static void convertSign8(byte[] buffer, int byteOffset, int sampleCount)(Code) | | |
convertSign8 | public static void convertSign8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount)(Code) | | |
intToBytes16 | public static void intToBytes16(int sample, byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts a 16 bit sample of type int to 2 bytes in an array.
sample is interpreted as signed (as Java does).
For little endian, buffer[byteOffset] is filled with low byte of sample,
and buffer[byteOffset+1] is filled with high byte of sample + sign bit.
For big endian, this is reversed.
Before calling this function, it should be assured that sample
is in the 16bit range - it will not be clipped.
This is a reference function.
|
intToBytes24 | public static void intToBytes24(int sample, byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts a 24 bit sample of type int to 3 bytes in an array.
sample is interpreted as signed (as Java does).
For little endian, buffer[byteOffset] is filled with low byte of sample,
and buffer[byteOffset+2] is filled with the high byte of sample + sign bit.
For big endian, this is reversed.
Before calling this function, it should be assured that sample
is in the 24bit range - it will not be clipped.
This is a reference function.
|
intToBytes32 | public static void intToBytes32(int sample, byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts a 32 bit sample of type int to 4 bytes in an array.
sample is interpreted as signed (as Java does).
For little endian, buffer[byteOffset] is filled with lowest byte of sample,
and buffer[byteOffset+3] is filled with the high byte of sample + sign bit.
For big endian, this is reversed.
This is a reference function.
|
linear2alaw | public static byte linear2alaw(short pcm_val)(Code) | | |
linear2ulaw | public static byte linear2ulaw(int sample)(Code) | | Converts a linear signed 16bit sample to a uLaw byte.
Ported to Java by fb.
Originally by:
Craig Reese: IDA/Supercomputing Research Center
Joe Campbell: Department of Defense
29 September 1989
|
pcm162alaw | public static void pcm162alaw(byte[] buffer, int byteOffset, int sampleCount, boolean bigEndian)(Code) | | Converts a buffer of signed 16bit big endian samples to uLaw.
The uLaw bytes overwrite the original 16 bit values.
The first byte-offset of the uLaw bytes is byteOffset.
It will be written sampleCount/2 bytes.
|
pcm162alaw | public static void pcm162alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian)(Code) | | Fills outBuffer with alaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount*2 bytes read from inBuffer;
There will be sampleCount bytes written to outBuffer.
|
pcm162ulaw | public static void pcm162ulaw(byte[] buffer, int byteOffset, int sampleCount, boolean bigEndian)(Code) | | Converts a buffer of signed 16bit big endian samples to uLaw.
The uLaw bytes overwrite the original 16 bit values.
The first byte-offset of the uLaw bytes is byteOffset.
It will be written sampleCount/2 bytes.
|
pcm162ulaw | public static void pcm162ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian)(Code) | | Fills outBuffer with ulaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount*2 bytes read from inBuffer;
There will be sampleCount bytes written to outBuffer.
|
pcm82alaw | public static void pcm82alaw(byte[] buffer, int byteOffset, int sampleCount, boolean signed)(Code) | | Converts a buffer of 8bit samples to alaw.
The alaw bytes overwrite the original 8 bit values.
The first byte-offset of the aLaw bytes is byteOffset.
It will be written sampleCount bytes.
|
pcm82alaw | public static void pcm82alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed)(Code) | | Fills outBuffer with alaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes written to outBuffer.
|
pcm82ulaw | public static void pcm82ulaw(byte[] buffer, int byteOffset, int sampleCount, boolean signed)(Code) | | Converts a buffer of 8bit samples to uLaw.
The uLaw bytes overwrite the original 8 bit values.
The first byte-offset of the uLaw bytes is byteOffset.
It will be written sampleCount bytes.
|
pcm82ulaw | public static void pcm82ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed)(Code) | | Fills outBuffer with ulaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes written to outBuffer.
|
shortToBytes16 | public static void shortToBytes16(short sample, byte[] buffer, int byteOffset, boolean bigEndian)(Code) | | Converts a sample of type short to 2 bytes in an array.
sample is interpreted as signed (as Java does).
For little endian, buffer[byteOffset] is filled with low byte of sample,
and buffer[byteOffset+1] is filled with high byte of sample.
For big endian, this is reversed.
This is a reference function.
|
swapOrder16 | public static void swapOrder16(byte[] buffer, int byteOffset, int sampleCount)(Code) | | |
swapOrder16 | public static void swapOrder16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount)(Code) | | |
swapOrder24 | public static void swapOrder24(byte[] buffer, int byteOffset, int sampleCount)(Code) | | |
swapOrder24 | public static void swapOrder24(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount)(Code) | | |
swapOrder32 | public static void swapOrder32(byte[] buffer, int byteOffset, int sampleCount)(Code) | | |
swapOrder32 | public static void swapOrder32(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount)(Code) | | |
ulaw2alaw | public static byte ulaw2alaw(byte sample)(Code) | | |
ulaw2alaw | public static void ulaw2alaw(byte[] buffer, int byteOffset, int sampleCount)(Code) | | Converts a buffer of uLaw samples to aLaw.
|
ulaw2alaw | public static void ulaw2alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount)(Code) | | Fills outBuffer with alaw samples.
|
ulaw2linear | public static short ulaw2linear(byte ulawbyte)(Code) | | |
ulaw2pcm16 | public static void ulaw2pcm16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian)(Code) | | Fills outBuffer with pcm signed 16 bit samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes read from inBuffer;
There will be sampleCount*2 bytes written to outBuffer.
|
ulaw2pcm8 | public static void ulaw2pcm8(byte[] buffer, int byteOffset, int sampleCount, boolean signed)(Code) | | Inplace-conversion of a ulaw buffer to 8bit samples.
The 8bit bytes overwrite the original ulaw values.
The first byte-offset of the uLaw bytes is byteOffset.
It will be written sampleCount bytes.
|
ulaw2pcm8 | public static void ulaw2pcm8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed)(Code) | | Fills outBuffer with ulaw samples.
reading starts from inBuffer[inByteOffset].
writing starts at outBuffer[outByteOffset].
There will be sampleCount bytes written to outBuffer.
|
|
|