|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarytts.tools.voiceimport.General
public class General
This class is for general purpose functions such as reading and writing from files, or converting formats of numbers.
| Constructor Summary | |
|---|---|
General()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
hex(float f)
Print a float type's internal bit representation in hex |
static void |
launchBatchProc(java.lang.String cmdLine,
java.lang.String task,
java.lang.String filedir)
A general process launcher for the various tasks but using an intermediate batch file |
static void |
launchProc(java.lang.String cmdLine,
java.lang.String task,
java.lang.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(java.io.DataInputStream dis)
Reads a single char from the stream |
static char[] |
readChars(java.io.DataInputStream dis,
int num)
Reads a given number of chars from the stream |
static float |
readFloat(java.io.DataInputStream dis,
boolean isBigEndian)
Read a float from the input stream, byte-swapping as necessary |
static int |
readInt(java.io.DataInputStream dis,
boolean isBigEndian)
Read an integer from the input stream, byte-swapping as necessary |
static float |
readLittleEndianFloat(java.io.DataInputStream dataStream)
Reads the next float from the given DataInputStream, where the data is in little endian. |
static int |
readLittleEndianInt(java.io.DataInputStream dataStream)
Reads the next little-endian integer from the given DataInputStream. |
static short |
readLittleEndianShort(java.io.DataInputStream dis)
Reads the next little-endian short from the given DataInputStream. |
static short |
readShort(java.io.DataInputStream dis,
boolean isBigEndian)
Read a short from the input stream, byte-swapping as necessary |
static java.lang.String |
readWord(java.io.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(java.io.DataOutputStream dos,
boolean isBigEndian,
float val)
Write a float from the output stream, byte-swapping as necessary |
static void |
writeInt(java.io.DataOutputStream dis,
boolean isBigEndian,
int val)
Writes an integer to the output stream, byte-swapping as necessary |
static void |
writeLittleEndianFloat(java.io.DataOutputStream dataStream,
float val)
Writes a float to the given DataOutputStream, where the data is in little endian. |
static void |
writeLittleEndianInt(java.io.DataOutputStream dataStream,
int val)
Writes a little-endian integer to the given DataOutputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public General()
| Method Detail |
|---|
public static java.lang.String readWord(java.io.DataInputStream dis)
throws java.io.IOException
dis - the input stream
java.io.IOException - on error
public static char readChar(java.io.DataInputStream dis)
throws java.io.IOException
dis - the stream to read
java.io.IOException - if an error occurs
public static char[] readChars(java.io.DataInputStream dis,
int num)
throws java.io.IOException
dis - the stream to readnum - the number of chars to read
num
in the stream
- Throws:
java.io.IOException - if an error occurs
public static float readFloat(java.io.DataInputStream dis,
boolean isBigEndian)
throws java.io.IOException
dis - the inputstreamisBigEndian - whether or not the data being read in is in
big endian format.
java.io.IOException - on error
public static void writeFloat(java.io.DataOutputStream dos,
boolean isBigEndian,
float val)
throws java.io.IOException
dos - the outputstreamisBigEndian - whether or not the data being read in is in
big endian format.val - the floating point value to write
java.io.IOException - on error
public static float readLittleEndianFloat(java.io.DataInputStream dataStream)
throws java.io.IOException
dataStream - the DataInputStream to read from
java.io.IOException
public static void writeLittleEndianFloat(java.io.DataOutputStream dataStream,
float val)
throws java.io.IOException
dataStream - the DataOutputStream to write to.val - The float value to write.
java.io.IOException
public static int readInt(java.io.DataInputStream dis,
boolean isBigEndian)
throws java.io.IOException
dis - the inputstreamisBigEndian - whether or not the data being read in is in
big endian format.
java.io.IOException - on error
public static void writeInt(java.io.DataOutputStream dis,
boolean isBigEndian,
int val)
throws java.io.IOException
dis - the outputstream.isBigEndian - whether or not the data being read in is in
big endian format.val - the integer value to write.
java.io.IOException - on error
public static int readLittleEndianInt(java.io.DataInputStream dataStream)
throws java.io.IOException
dataStream - the DataInputStream to read from
java.io.IOException
public static void writeLittleEndianInt(java.io.DataOutputStream dataStream,
int val)
throws java.io.IOException
dataStream - the DataOutputStream to write toval - the integer value to write
java.io.IOException - on error
public static short readShort(java.io.DataInputStream dis,
boolean isBigEndian)
throws java.io.IOException
dis - the inputstreamisBigEndian - whether or not the data being read in is in
big endian format.
java.io.IOException - on error
public static short readLittleEndianShort(java.io.DataInputStream dis)
throws java.io.IOException
dataStream - the DataInputStream to read from
java.io.IOExceptionpublic static byte shortToUlaw(short sample)
sample - the short to convert
public 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 ulaw
public static byte[] shortToUlaw(short[] samples)
samples - an array in linear representation
shortToUlaw(short)public static short[] ulawToShort(byte[] ulaw)
samples - an array in ulaw representation
ulawToShort(byte)public static java.lang.String hex(float f)
f - the float to print
f
public static short quantize(float f,
float fMin,
float fRange)
f - the float to quantizemin - the minimum possible value for variable frange - the possible range for variable f
public static short[] quantize(float[] f,
float fMin,
float fRange)
f - the array of floats to quantizemin - the minimum possible value for variable frange - the possible range for variable f
public static float unQuantize(short s,
float fMin,
float fRange)
s - the 16bits signed codewordmin - the minimum possible value for variable frange - the possible range for variable f
public static float[] unQuantize(short[] s,
float fMin,
float fRange)
s - the array of 16bits signed codewordsmin - the minimum possible value for variable frange - the possible range for variable f
public static void launchProc(java.lang.String cmdLine,
java.lang.String task,
java.lang.String baseName)
cmdLine - the command line to be launched.task - a task tag for error messages, such as "Pitchmarks" or "LPC".the - basename of the file currently processed, for error messages.
public static void launchBatchProc(java.lang.String cmdLine,
java.lang.String task,
java.lang.String filedir)
cmdLine - the command line to be launched.task - a task tag for error messages, such as "Pitchmarks" or "LPC".the - filedir of the file currently processed, for error messages and for creating a
temporal batch file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||