public static double[][] readMfccs(DataInputStream stream, MfccFileHeader params) throws IOException { double[][] mfccs = null; if (stream != null && params.numfrm > 0 && params.dimension > 0) { mfccs = new double[params.numfrm][]; for (int i = 0; i < mfccs.length; i++) { mfccs[i] = StreamUtils.readDoubleArray(stream, params.dimension); } stream.close(); } return mfccs; }
/** * Method which loads the header from a byte buffer. * * @param bb * byte buffer to read from, must not be null. * @throws BufferUnderflowException * , UTFDataFormatException if no proc header can be read at the current position. * @throws UTFDataFormatException * UTFDataFormatException */ private void loadProcHeader(ByteBuffer bb) throws BufferUnderflowException, UTFDataFormatException { procHeader = StreamUtils.readUTF(bb); assert procHeader != null; }
public static void writeLsfs(DataOutputStream stream, double[][] lsfs) throws IOException { if (stream != null && lsfs != null && lsfs.length > 0) { for (int i = 0; i < lsfs.length; i++) { StreamUtils.writeDoubleArray(stream, lsfs[i]); } stream.close(); } }
int utflen = readUnsignedShort(bb); byte[] bytearr = new byte[utflen]; char[] chararr = new char[utflen];
int utflen = readUnsignedShort(bb); byte[] bytearr = new byte[utflen]; char[] chararr = new char[utflen];
/** * Method which loads the header from a byte buffer. * * @param bb * byte buffer to read from, must not be null. * @throws BufferUnderflowException * , UTFDataFormatException if no proc header can be read at the current position. * @throws UTFDataFormatException * UTFDataFormatException */ private void loadProcHeader(ByteBuffer bb) throws BufferUnderflowException, UTFDataFormatException { procHeader = StreamUtils.readUTF(bb); assert procHeader != null; }
public static double[][] readLsfs(DataInputStream stream, LsfFileHeader params) throws IOException { double[][] lsfs = null; if (stream != null && params.numfrm > 0 && params.dimension > 0) { lsfs = new double[params.numfrm][]; for (int i = 0; i < lsfs.length; i++) { lsfs[i] = StreamUtils.readDoubleArray(stream, params.dimension); } stream.close(); } return lsfs; }
public static void writeLsfs(DataOutputStream stream, double[][] lsfs) throws IOException { if (stream != null && lsfs != null && lsfs.length > 0) { for (int i = 0; i < lsfs.length; i++) { StreamUtils.writeDoubleArray(stream, lsfs[i]); } stream.close(); } }
String featureName = StreamUtils.readUTF(bb); featureNames.set(i, featureName); byte numberOfValuesEncoded = bb.get(); // attention: this is an unsigned byte byteFeatureValues[i] = new ByteStringTranslator(numberOfValues); for (int b = 0; b < numberOfValues; b++) { String value = StreamUtils.readUTF(bb); byteFeatureValues[i].set((byte) b, value); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = bb.getShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); for (short s = 0; s < numberOfValues; s++) { String value = StreamUtils.readUTF(bb); shortFeatureValues[i].set(s, value); floatWeightFuncts[i] = StreamUtils.readUTF(bb); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
public static double[][] readVqs(DataInputStream stream, VoiceQualityFileHeader params) throws IOException { double[][] vqs = null; if (stream != null && params.dimension > 0 && params.dimension > 0) { vqs = new double[params.dimension][]; for (int i = 0; i < vqs.length; i++) { vqs[i] = StreamUtils.readDoubleArray(stream, params.numfrm); } stream.close(); } return vqs; }
public static void writeVqs(DataOutputStream stream, double[][] vqs) throws IOException { if (stream != null && vqs != null && vqs.length > 0) { for (int i = 0; i < vqs.length; i++) { StreamUtils.writeDoubleArray(stream, vqs[i]); } stream.close(); } }
String featureName = StreamUtils.readUTF(bb); featureNames.set(i, featureName); byte numberOfValuesEncoded = bb.get(); // attention: this is an unsigned byte byteFeatureValues[i] = new ByteStringTranslator(numberOfValues); for (int b = 0; b < numberOfValues; b++) { String value = StreamUtils.readUTF(bb); byteFeatureValues[i].set((byte) b, value); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + i, featureName); short numberOfValues = bb.getShort(); shortFeatureValues[i] = new ShortStringTranslator(numberOfValues); for (short s = 0; s < numberOfValues; s++) { String value = StreamUtils.readUTF(bb); shortFeatureValues[i].set(s, value); floatWeightFuncts[i] = StreamUtils.readUTF(bb); String featureName = StreamUtils.readUTF(bb); featureNames.set(numByteFeatures + numShortFeatures + i, featureName);
public static double[][] readMfccs(DataInputStream stream, MfccFileHeader params) throws IOException { double[][] mfccs = null; if (stream != null && params.numfrm > 0 && params.dimension > 0) { mfccs = new double[params.numfrm][]; for (int i = 0; i < mfccs.length; i++) { mfccs[i] = StreamUtils.readDoubleArray(stream, params.dimension); } stream.close(); } return mfccs; }
public static void writeMfccs(DataOutputStream stream, double[][] mfccs) throws IOException { if (stream != null && mfccs != null && mfccs.length > 0) { for (int i = 0; i < mfccs.length; i++) { StreamUtils.writeDoubleArray(stream, mfccs[i]); } stream.close(); } }
for (int i = 0; i < numberOfFeatures; i++) { featureWeight[i] = bb.getFloat(); wfStr = StreamUtils.readUTF(bb); if ("".equals(wfStr)) weightFunction[i] = wfm.getWeightFunction("linear");
public static double[][] readVqs(DataInputStream stream, VoiceQualityFileHeader params) throws IOException { double[][] vqs = null; if (stream != null && params.dimension > 0 && params.dimension > 0) { vqs = new double[params.dimension][]; for (int i = 0; i < vqs.length; i++) { vqs[i] = StreamUtils.readDoubleArray(stream, params.numfrm); } stream.close(); } return vqs; }
public static void writeMfccs(DataOutputStream stream, double[][] mfccs) throws IOException { if (stream != null && mfccs != null && mfccs.length > 0) { for (int i = 0; i < mfccs.length; i++) { StreamUtils.writeDoubleArray(stream, mfccs[i]); } stream.close(); } }
for (int i = 0; i < numberOfFeatures; i++) { featureWeight[i] = bb.getFloat(); wfStr = StreamUtils.readUTF(bb); if ("".equals(wfStr)) weightFunction[i] = wfm.getWeightFunction("linear");
public static double[][] readLsfs(DataInputStream stream, LsfFileHeader params) throws IOException { double[][] lsfs = null; if (stream != null && params.numfrm > 0 && params.dimension > 0) { lsfs = new double[params.numfrm][]; for (int i = 0; i < lsfs.length; i++) { lsfs[i] = StreamUtils.readDoubleArray(stream, params.dimension); } stream.close(); } return lsfs; }
public static void writeVqs(DataOutputStream stream, double[][] vqs) throws IOException { if (stream != null && vqs != null && vqs.length > 0) { for (int i = 0; i < vqs.length; i++) { StreamUtils.writeDoubleArray(stream, vqs[i]); } stream.close(); } }