public class General extends Object
| Constructor and Description |
|---|
General() |
| Modifier and Type | Method and Description |
|---|---|
static String |
hex(float f)
Print a float type's internal bit representation in hex
|
static void |
launchBatchProc(String cmdLine,
String task,
String filedir)
A general process launcher for the various tasks but using an intermediate batch file
|
static void |
launchProc(String cmdLine,
String task,
String baseName)
A general process launcher for the various tasks
|
static short[] |
quantize(float[] f,
float fMin,
float fRange)
Quantize an array of floats over the 16bits signed short range
|
static short |
quantize(float f,
float fMin,
float fRange)
Quantize a float variable over the 16bits signed short range
|
static char |
readChar(DataInputStream dis)
Reads a single char from the stream
|
static char[] |
readChars(DataInputStream dis,
int num)
Reads a given number of chars from the stream
|
static float |
readFloat(DataInputStream dis,
boolean isBigEndian)
Read a float from the input stream, byte-swapping as necessary
|
static int |
readInt(DataInputStream dis,
boolean isBigEndian)
Read an integer from the input stream, byte-swapping as necessary
|
static float |
readLittleEndianFloat(DataInputStream dataStream)
Reads the next float from the given DataInputStream, where the data is in little endian.
|
static int |
readLittleEndianInt(DataInputStream dataStream)
Reads the next little-endian integer from the given DataInputStream.
|
static short |
readLittleEndianShort(DataInputStream dis)
Reads the next little-endian short from the given DataInputStream.
|
static short |
readShort(DataInputStream dis,
boolean isBigEndian)
Read a short from the input stream, byte-swapping as necessary
|
static String |
readWord(DataInputStream dis)
Reads the next word (text separated by whitespace) from the given stream
|
static byte |
shortToUlaw(short sample)
Convert a short to ulaw format
|
static byte[] |
shortToUlaw(short[] samples)
Convert an array from short to ulaw.
|
static short |
ulawToShort(byte ulaw)
Convert a ulaw format to short
|
static short[] |
ulawToShort(byte[] ulaw)
Convert an array from ulaw to short.
|
static float[] |
unQuantize(short[] s,
float fMin,
float fRange)
Unquantize an array of 16bits signed shorts over a float range
|
static float |
unQuantize(short s,
float fMin,
float fRange)
Unquantize a 16bits signed short over a float range
|
static void |
writeFloat(DataOutputStream dos,
boolean isBigEndian,
float val)
Write a float from the output stream, byte-swapping as necessary
|
static void |
writeInt(DataOutputStream dis,
boolean isBigEndian,
int val)
Writes an integer to the output stream, byte-swapping as necessary
|
static void |
writeLittleEndianFloat(DataOutputStream dataStream,
float val)
Writes a float to the given DataOutputStream, where the data is in little endian.
|
static void |
writeLittleEndianInt(DataOutputStream dataStream,
int val)
Writes a little-endian integer to the given DataOutputStream.
|
public static String readWord(DataInputStream dis) throws IOException
dis - the input streamIOException - on errorpublic static char readChar(DataInputStream dis) throws IOException
dis - the stream to readIOException - if an error occurspublic static char[] readChars(DataInputStream dis, int num) throws IOException
dis - the stream to readnum - the number of chars to readnum in the streamIOException - if an error occurspublic static float readFloat(DataInputStream dis, boolean isBigEndian) throws IOException
dis - the inputstreamisBigEndian - whether or not the data being read in is in big endian format.IOException - on errorpublic static void writeFloat(DataOutputStream dos, boolean isBigEndian, float val) throws IOException
dos - the outputstreamisBigEndian - whether or not the data being read in is in big endian format.val - the floating point value to writeIOException - on errorpublic static float readLittleEndianFloat(DataInputStream dataStream) throws IOException
dataStream - the DataInputStream to read fromIOException - IOExceptionpublic static void writeLittleEndianFloat(DataOutputStream dataStream, float val) throws IOException
dataStream - the DataOutputStream to write to.val - The float value to write.IOException - IOExceptionpublic static int readInt(DataInputStream dis, boolean isBigEndian) throws IOException
dis - the inputstreamisBigEndian - whether or not the data being read in is in big endian format.IOException - on errorpublic static void writeInt(DataOutputStream dis, boolean isBigEndian, int val) throws IOException
dis - the outputstream.isBigEndian - whether or not the data being read in is in big endian format.val - the integer value to write.IOException - on errorpublic static int readLittleEndianInt(DataInputStream dataStream) throws IOException
dataStream - the DataInputStream to read fromIOException - IOExceptionpublic static void writeLittleEndianInt(DataOutputStream dataStream, int val) throws IOException
dataStream - the DataOutputStream to write toval - the integer value to writeIOException - on errorpublic static short readShort(DataInputStream dis, boolean isBigEndian) throws IOException
dis - the inputstreamisBigEndian - whether or not the data being read in is in big endian format.IOException - on errorpublic static short readLittleEndianShort(DataInputStream dis) throws IOException
dis - the DataInputStream to read fromIOException - IOExceptionpublic static byte shortToUlaw(short sample)
sample - the short to convertpublic static short ulawToShort(byte ulaw)
ulaw - a (signed) byte which, after converting into a short and adding 128, will be an unsigned 8-but quantity
representing a ulawpublic static byte[] shortToUlaw(short[] samples)
samples - an array in linear representationshortToUlaw(short)public static short[] ulawToShort(byte[] ulaw)
ulaw - an array in ulaw representationulawToShort(byte)public static String hex(float f)
f - the float to printfpublic static short quantize(float f,
float fMin,
float fRange)
f - the float to quantizefMin - the minimum possible value for variable ffRange - the possible range for variable fpublic static short[] quantize(float[] f,
float fMin,
float fRange)
f - the array of floats to quantizefMin - the minimum possible value for variable ffRange - the possible range for variable fpublic static float unQuantize(short s,
float fMin,
float fRange)
s - the 16bits signed codewordfMin - the minimum possible value for variable ffRange - the possible range for variable fpublic static float[] unQuantize(short[] s,
float fMin,
float fRange)
s - the array of 16bits signed codewordsfMin - the minimum possible value for variable ffRange - the possible range for variable fpublic static void launchProc(String cmdLine, String task, String baseName)
cmdLine - the command line to be launched.task - a task tag for error messages, such as "Pitchmarks" or "LPC".baseName - basename of the file currently processed, for error messages.public static void launchBatchProc(String cmdLine, String task, String filedir)
cmdLine - the command line to be launched.task - a task tag for error messages, such as "Pitchmarks" or "LPC".filedir - filedir of the file currently processed, for error messages and for creating a temporal batch file.Copyright © 2000–2016 DFKI GmbH. All rights reserved.