[marf-cvs] marf/src/marf/gui GUIException.java, 1.1, 1.1.4.1 Spectrogram.java, 1.30, 1.30.8.1 WaveG
Brought to you by:
mokhov
From: Serguei A. M. <mo...@us...> - 2008-04-09 00:32:53
|
Update of /cvsroot/marf/marf/src/marf/gui In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9497/src/marf/gui Modified Files: Tag: DISTRIBUTED_MARF_0_3_0_INTEGRATION GUIException.java Spectrogram.java WaveGrapher.java Log Message: Consolidate most of the differences between the MAIN and Distributed MARF branches. This primarily includes the copyright year update to 2008, SpeakerIdentApp with the new options of loaders and the BandStopFilter, ZipfLaw, CosineSimilarityMeasure, and HammingDistance. Include stats per config along with stats per subject. Add timing measurements. A lot of comment spell checks and other corrections. Generalize some of the code, fix naming conventions in places. Fix some bugs that popped up in the main branch down to DMARF. Add some new implementation developments, such as nlp.Storage and Classification.Similarity. Refactor Configuration and some other classes. Make WAVLoader more customizable, in particular being able to load 16000 Hz samples. Many other fixes that will be summarized in the MAIN's ChangeLog. Index: GUIException.java =================================================================== RCS file: /cvsroot/marf/marf/src/marf/gui/GUIException.java,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** GUIException.java 2 Mar 2006 01:23:25 -0000 1.1 --- GUIException.java 9 Apr 2008 00:32:18 -0000 1.1.4.1 *************** *** 9,13 **** * </p> * ! * <p>$Id$</p> * * @author Serguei Mokhov --- 9,13 ---- * </p> * ! * $Id$ * * @author Serguei Mokhov Index: WaveGrapher.java =================================================================== RCS file: /cvsroot/marf/marf/src/marf/gui/WaveGrapher.java,v retrieving revision 1.15 retrieving revision 1.15.6.1 diff -C2 -d -r1.15 -r1.15.6.1 *** WaveGrapher.java 21 Jan 2006 02:35:32 -0000 1.15 --- WaveGrapher.java 9 Apr 2008 00:32:19 -0000 1.15.6.1 *************** *** 13,19 **** /** ! * Class WaveGrapher. * ! * <p>$Id$</p> * * @author Stephen Sinclair --- 13,19 ---- /** ! * <p>Class WaveGrapher.</p> * ! * $Id$ * * @author Stephen Sinclair *************** *** 116,120 **** * Returns source code revision information. * @return revision string ! * @since 0.3.0 */ public static String getMARFSourceCodeRevision() --- 116,120 ---- * Returns source code revision information. * @return revision string ! * @since 0.3.0.2 */ public static String getMARFSourceCodeRevision() Index: Spectrogram.java =================================================================== RCS file: /cvsroot/marf/marf/src/marf/gui/Spectrogram.java,v retrieving revision 1.30 retrieving revision 1.30.8.1 diff -C2 -d -r1.30 -r1.30.8.1 *** Spectrogram.java 13 Aug 2005 23:09:38 -0000 1.30 --- Spectrogram.java 9 Apr 2008 00:32:19 -0000 1.30.8.1 *************** *** 15,19 **** * <p>Class Spectrogram dumps a spectrogram to a PPM file.</p> * ! * <p>$Id$</p> * * @author Ian Clement --- 15,19 ---- * <p>Class Spectrogram dumps a spectrogram to a PPM file.</p> * ! * $Id$ * * @author Ian Clement *************** *** 25,29 **** extends StorageManager { ! /** * For serialization versioning. * When adding new members or make other structural --- 25,29 ---- extends StorageManager { ! /** * For serialization versioning. * When adding new members or make other structural *************** *** 33,50 **** */ private static final long serialVersionUID = -8219029755014757254L; /** * The data vector. */ ! protected Vector data = null; /** * Current minimum. */ ! protected double min = 0.0; /** * Current maximum. */ ! protected double max = 0.0; /** --- 33,51 ---- */ private static final long serialVersionUID = -8219029755014757254L; + /** * The data vector. */ ! protected Vector oData = null; /** * Current minimum. */ ! protected double dMin = 0.0; /** * Current maximum. */ ! protected double dMax = 0.0; /** *************** *** 58,62 **** public Spectrogram() { ! this.data = new Vector(); } --- 59,63 ---- public Spectrogram() { ! this.oData = new Vector(); } *************** *** 73,93 **** /** * Adds LPC spectrum to the data to dump. ! * @param lpc_coeffs LPC coefficiencies to dump ! * @param num_coeffs number of LPC coefficiencies to dump ! * @param size size of the spectrogram (width) */ ! public final void addLPC(final double[] lpc_coeffs, final int num_coeffs, final int size) { ! double[] to_insert = new double[size]; ! for(int i = 0; i < size; i++) { double Ar = 1.0; double Ai = 0.0; ! for(int k = 0; k < num_coeffs; k++) { ! Ar -= lpc_coeffs[k] * Math.cos(2 * Math.PI * i * -k / 128); ! Ai -= lpc_coeffs[k] * Math.sin(2 * Math.PI * i * -k / 128); } --- 74,94 ---- /** * Adds LPC spectrum to the data to dump. ! * @param padLPCCoeffs LPC coefficiencies to dump ! * @param piNumCoeffs number of LPC coefficiencies to dump ! * @param piSize size of the spectrogram (width) */ ! public final void addLPC(final double[] padLPCCoeffs, final int piNumCoeffs, final int piSize) { ! double[] adToInsert = new double[piSize]; ! for(int i = 0; i < piSize; i++) { double Ar = 1.0; double Ai = 0.0; ! for(int k = 0; k < piNumCoeffs; k++) { ! Ar -= padLPCCoeffs[k] * Math.cos(2 * Math.PI * i * -k / 128); ! Ai -= padLPCCoeffs[k] * Math.sin(2 * Math.PI * i * -k / 128); } *************** *** 95,133 **** double H = 1.0 / A; ! if(H > this.max) ! this.max = H; else ! if(H < this.min) ! this.min = H; ! to_insert[i] = H; } ! this.data.add(to_insert); } /** * Adds FFT spectrum to the data to dump. ! * @param values array of doubles (FFT coefficiencies) */ ! public final void addFFT(final double[] values) { ! double[] to_insert = new double[values.length / 2]; ! if(this.data.size() == 0) ! this.min = this.max = values[0]; ! for(int k = 0; k < to_insert.length; k++) { ! if(values[k] > max) ! this.max = values[k]; ! if(values[k] < min) ! this.min = values[k]; ! to_insert[k] = values[k]; } ! this.data.add(to_insert); } --- 96,146 ---- double H = 1.0 / A; ! if(H > this.dMax) ! { ! this.dMax = H; ! } else ! { ! if(H < this.dMin) ! { ! this.dMin = H; ! } ! } ! adToInsert[i] = H; } ! this.oData.add(adToInsert); } /** * Adds FFT spectrum to the data to dump. ! * @param padValues array of doubles (FFT coefficiencies) */ ! public final void addFFT(final double[] padValues) { ! double[] adToInsert = new double[padValues.length / 2]; ! if(this.oData.size() == 0) ! { ! this.dMin = this.dMax = padValues[0]; ! } ! for(int k = 0; k < adToInsert.length; k++) { ! if(padValues[k] > dMax) ! { ! this.dMax = padValues[k]; ! } ! if(padValues[k] < dMin) ! { ! this.dMin = padValues[k]; ! } ! adToInsert[k] = padValues[k]; } ! this.oData.add(adToInsert); } *************** *** 142,154 **** { Debug.debug("Dumping spectrogram " + MARF.getSampleFile() + "." + this.strMethod + ".ppm"); ! Debug.debug("Spectrogram.dump() - data size in vectors: " + data.size()); ! FileOutputStream fos = null; ! DataOutputStream outfile = null; ! fos = new FileOutputStream(MARF.getSampleFile() + "." + this.strMethod + ".ppm"); ! outfile = new DataOutputStream(fos); ! // Ouput PPM header /* man ppm: --- 155,167 ---- { Debug.debug("Dumping spectrogram " + MARF.getSampleFile() + "." + this.strMethod + ".ppm"); ! Debug.debug("Spectrogram.dump() - data size in vectors: " + oData.size()); ! FileOutputStream oFOS = null; ! DataOutputStream oOutFile = null; ! oFOS = new FileOutputStream(MARF.getSampleFile() + "." + this.strMethod + ".ppm"); ! oOutFile = new DataOutputStream(oFOS); ! // Output PPM header /* man ppm: *************** *** 177,204 **** // Make max be at 75% ! this.max *= 0.75; ! int length = ((double[])this.data.elementAt(0)).length; ! outfile.writeBytes("P6\n" + this.data.size() + "\n" + length + "\n255\n"); ! for(int j = length - 1; j >= 0; j--) { ! for(int i = 0; i < this.data.size(); i++) { ! double[] adData = (double[])this.data.elementAt(i); for(int m = 0; m < 3; m++) { ! double val; ! if(adData[j] > this.max) ! val = this.max; ! else if(adData[j] < this.min) ! val = this.min; else ! val = adData[j]; ! outfile.writeByte((int)(((this.max - val) / this.max) * 256)); } } --- 190,223 ---- // Make max be at 75% ! this.dMax *= 0.75; ! int iLength = ((double[])this.oData.elementAt(0)).length; ! oOutFile.writeBytes("P6\n" + this.oData.size() + "\n" + iLength + "\n255\n"); ! for(int j = iLength - 1; j >= 0; j--) { ! for(int i = 0; i < this.oData.size(); i++) { ! double[] adData = (double[])this.oData.elementAt(i); for(int m = 0; m < 3; m++) { ! double dVal; ! if(adData[j] > this.dMax) ! { ! dVal = this.dMax; ! } ! else if(adData[j] < this.dMin) ! { ! dVal = this.dMin; ! } else ! { ! dVal = adData[j]; ! } ! oOutFile.writeByte((int)(((this.dMax - dVal) / this.dMax) * 256)); } } *************** *** 209,213 **** "Done dumping spectrogram " + MARF.getSampleFile() + "." + this.strMethod + ! ".ppm [" + (this.data.size() * length * 3) + " bytes]" ); } --- 228,232 ---- "Done dumping spectrogram " + MARF.getSampleFile() + "." + this.strMethod + ! ".ppm [" + (this.oData.size() * iLength * 3) + " bytes]" ); } *************** *** 232,236 **** * Returns source code revision information. * @return revision string ! * @since 0.3.0 */ public static String getMARFSourceCodeRevision() --- 251,255 ---- * Returns source code revision information. * @return revision string ! * @since 0.3.0.2 */ public static String getMARFSourceCodeRevision() |