[made MEAPUtils more consistent - for use in unified MEAPsoftGUI interface
ronw@ee.columbia.edu**20060423154622] {
hunk ./src/com/meapsoft/Chunk.java 14
-public class Chunk implements Comparable
+public abstract class Chunk implements Comparable
hunk ./src/com/meapsoft/Composer.java 17
+     *
+     * This should be called before any call to compose() to ensure
+     * that the inputs and outputs are properly initialized.
hunk ./src/com/meapsoft/Composer.java 21
-    public abstract void setup();
+    public void setup() throws IOException, ParserException
+    {
+        // clear old EDL
+        outFile.clearChunks(); 
+    }
+
hunk ./src/com/meapsoft/Composer.java 38
-        setup();
-        compose();
-
hunk ./src/com/meapsoft/Composer.java 40
+            setup();
+            compose();
hunk ./src/com/meapsoft/Composer.java 44
-        catch(IOException e)
+        catch(Exception e)
hunk ./src/com/meapsoft/EDLChunk.java 7
+ * Note that EDLChunk extends FeatChunk so that it can inherit the
+ * feature stuff from FeatChunk.  This is really only to associate
+ * each EDL chunk with a set of features for visualization purposes
+ * (i.e. with ImagePanel, to see how the composers rearrange things)
+ * since the features associated with chunks in EDLs are basically
+ * irrelevant.
+ *
hunk ./src/com/meapsoft/EDLChunk.java 17
-public class EDLChunk extends Chunk
+public class EDLChunk extends FeatChunk
hunk ./src/com/meapsoft/EDLChunk.java 22
-    private double[] features = null;
- 
hunk ./src/com/meapsoft/EDLChunk.java 41
-        setFeatures(c.getFeatures());
-    }
-
-    /**
-     * The EDLChunk set/getFeatures methods are really only to
-     * associate each EDL chunk with a set of features for
-     * visualization purposes (i.e. with ImagePanel, to see how the
-     * composers rearrange things) since the features associated with
-     * chunks in EDLs are basically irrelevant.
-     */
-    public void setFeatures(double[] f)
-    {
-        features = f;
-    }
-
-    /**
-     * Get the features associated with this chunk
-     */
-    public double[] getFeatures()
-    {
-        return features;
-    }
-    
-    /**
-     * Get the subset of features corresponding to the dimensions
-     * listed in idx.
-     */
-    public double[] getFeatures(int[] idx)
-    {
-        if (idx == null)
-            return getFeatures();
-
-        double[] feats = new double[idx.length];
-
-        for(int i = 0; i < idx.length; i++)
-            feats[i] = features[idx[i]];
-
-        return feats;
+        features = c.features;
hunk ./src/com/meapsoft/EDLFile.java 13
-public class EDLFile extends MEAPFile
+public class EDLFile extends FeatFile
hunk ./src/com/meapsoft/EDLFile.java 15
-    //Vector chunks;  // Vector of EDLChunks
-    // keep them sorted
-    MaxHeap chunks;  
-    
-    // regular expressions for parsing EDLFiles
-    private static final Pattern commentPattern = Pattern.compile("#\\.*");
-    private static final Pattern linePattern = Pattern.compile("\\s*([^#\\s]+)\\s*");
-
-    public  EDLFile(String fn)
+    public EDLFile(String fn)
hunk ./src/com/meapsoft/EDLFile.java 19
-        //chunks = new Vector();
-        chunks = new MaxHeap();
+        // keep chunks somewhat sorted
+        chunks = new MaxHeap(100);
hunk ./src/com/meapsoft/EDLFile.java 99
+        haveReadFile = true;
hunk ./src/com/meapsoft/EDLFile.java 102
+
+    public double[][] getFeatures(int[] featdim)
+    {
+        // want chunks sorted in time;
+        ((MaxHeap)chunks).sort();
+
+        double[][] f = super.getFeatures(featdim);
+
+        // the above call destroys the Heap property in chunks, need to fix it here.
+        ((MaxHeap)chunks).rebuildHeap();
+
+        return f;
+    }
+
hunk ./src/com/meapsoft/EDLFile.java 125
-        chunks.sort();
+        ((MaxHeap)chunks).sort();
hunk ./src/com/meapsoft/EDLFile.java 130
+        
+        // the above call destroys the Heap property in chunks, need to fix it here.
+        ((MaxHeap)chunks).rebuildHeap();
hunk ./src/com/meapsoft/FeatChunk.java 11
-public class FeatChunk extends Chunk
+public class FeatChunk extends Chunk implements Cloneable
hunk ./src/com/meapsoft/FeatChunk.java 13
-    private Vector features = null;
+    protected Vector features = null;
hunk ./src/com/meapsoft/FeatChunk.java 82
+        if(features == null)
+            return null;
+
hunk ./src/com/meapsoft/FeatChunk.java 97
+     *  Remove the features associated with this Chunk
+     */
+    public void clearFeatures()
+    {
+        features.clear();
+    }
+
+    /**
hunk ./src/com/meapsoft/FeatChunk.java 125
+    }
+
+    /**
+     * Clone this FeatChunk
+     */
+    public Object clone()
+    {
+        FeatChunk o = new FeatChunk(this.srcFile, this.startTime, this.length);
+        o.comment = this.comment;
+        o.features = (Vector)this.features.clone();
+
+        return o;
hunk ./src/com/meapsoft/FeatExtractor.java 27
-    public void printUsageAndExit() 
-    {
-        System.out.println("Usage: FeatExtractor [-options] file1.feat file2.feat ... \n\n" + 
-             "  where options include:\n" + 
-             "    -o output_file  append features into output file (defaults to input file)");
-        printCommandLineOptions('f');
-        System.out.println();
-        System.exit(0);
-    }
-
hunk ./src/com/meapsoft/FeatExtractor.java 47
+    public void printUsageAndExit() 
+    {
+        System.out.println("Usage: FeatExtractor [-options] file1.feat file2.feat ... \n\n" + 
+             "  where options include:\n" + 
+             "    -o output_file  append features into output file (defaults to input file)");
+        printCommandLineOptions('f');
+        System.out.println();
+        System.exit(0);
+    }
+
hunk ./src/com/meapsoft/FeatExtractor.java 102
-    
+
+    public void setup() throws IOException, ParserException
+    {
+        for(int i = 0; i < featFiles.length; i++) 
+            if(!featFiles[i].haveReadFile)
+                featFiles[i].readFile();
+    }
+ 
hunk ./src/com/meapsoft/FeatExtractor.java 114
-    public FeatFile[] processFeatFiles() throws IOException, ParserException
+    public FeatFile[] processFeatFiles() throws IOException
hunk ./src/com/meapsoft/FeatExtractor.java 123
-     * Where the magic happens.  Extract features from the given argument.
+     * Where the magic happens.  Extract features from file.
hunk ./src/com/meapsoft/FeatExtractor.java 125
-    public FeatFile processFeatFile(FeatFile file) throws IOException, ParserException
+    public FeatFile processFeatFile(FeatFile f) throws IOException
hunk ./src/com/meapsoft/FeatExtractor.java 127
+        FeatFile file = (FeatFile)f.clone();
+
hunk ./src/com/meapsoft/FeatExtractor.java 130
-        file.readFile();
-        
+
hunk ./src/com/meapsoft/FeatExtractor.java 139
+
hunk ./src/com/meapsoft/FeatExtractor.java 170
+        }
+
+        if(outFile != null)
+        {
+            outFile.chunks.addAll(file.chunks);
+            // outFile now contains some chunks.
+            outFile.haveReadFile = true;
hunk ./src/com/meapsoft/FeatExtractor.java 183
+    /**
+     * Set everything up, process input, and write output.
+     */
hunk ./src/com/meapsoft/FeatExtractor.java 188
+        try
+        {
+            setup();
+        }
+        catch(Exception e) 
+        {
+            e.printStackTrace();
+            System.exit(1);
+        }
+
+        FeatFile fn = outFile;
+
hunk ./src/com/meapsoft/FeatExtractor.java 203
-            FeatFile fn = outFile;
-            if(fn == null)
+            if(outFile == null)
hunk ./src/com/meapsoft/FeatFile.java 13
-public class FeatFile extends MEAPFile
+public class FeatFile extends MEAPFile implements Cloneable
hunk ./src/com/meapsoft/FeatFile.java 19
-    private static final Pattern commentPattern = Pattern.compile("#\\.*");
-    private static final Pattern linePattern = Pattern.compile("\\s*([^#\\s]+)\\s*");
+    protected static final Pattern commentPattern = Pattern.compile("#\\.*");
+    protected static final Pattern linePattern = Pattern.compile("\\s*([^#\\s]+)\\s*");
hunk ./src/com/meapsoft/FeatFile.java 25
-
hunk ./src/com/meapsoft/FeatFile.java 27
+
+    // Java bitches if this is not present for some reason.  Don't use
+    // it - its bad news.
+    protected FeatFile() { }
hunk ./src/com/meapsoft/FeatFile.java 154
+        haveReadFile = true;
+    }
+    
+    /**
+     *  Remove any chunks in this file
+     */
+    public void clearChunks()
+    {
+        chunks.clear();
+    }
+
+    /**
+     *  Remove the features of all chunks in this file
+     */
+    public void clearFeatures()
+    {
+        Iterator i = chunks.iterator();
+        while(i.hasNext())
+            ((FeatChunk)i.next()).clearFeatures();
hunk ./src/com/meapsoft/FeatFile.java 187
+    }
+
+    /**
+     * Clone this FeatFile
+     */
+    public Object clone()
+    {
+        FeatFile o = new FeatFile(this.filename);
+       
+        // superclass (MEAPFile) fields
+        o.haveReadFile = this.haveReadFile;
+        o.haveWrittenFile = this.haveWrittenFile;
+
+        // local fields
+        o.featureDescription = this.featureDescription;
+
+        o.chunks = new Vector();
+        Iterator i = this.chunks.iterator();
+        while(i.hasNext())
+            o.chunks.add(((FeatChunk)i.next()).clone());
+
+        return o;
hunk ./src/com/meapsoft/Heap.java 18
+    // Comparator to use to compare two elements in this Heap (if this
+    // is null, assume that all elements are Comparable)
hunk ./src/com/meapsoft/Heap.java 21
+    // does the current instance obey the heap property?
+    protected boolean isHeap = true;
hunk ./src/com/meapsoft/Heap.java 53
+        if(!isHeap)
+            rebuildHeap();
+
hunk ./src/com/meapsoft/Heap.java 84
+        if(!isHeap)
+            rebuildHeap();
+
hunk ./src/com/meapsoft/Heap.java 133
+
+        isHeap = true; 
hunk ./src/com/meapsoft/Heap.java 155
+
+        // the above code destroys the heap property - the array is
+        // essentially in reverse sorted order (with respect to the
+        // first element in the heap (min if MinHeap, max if MaxHeap))
+        //
+        // The next call to one of the Heap methods will rebuild the
+        // heap.
+        isHeap = false; 
hunk ./src/com/meapsoft/MEAPFile.java 15
+    public boolean haveReadFile = false;
+    public boolean haveWrittenFile = false;
hunk ./src/com/meapsoft/MEAPFile.java 58
+
+        haveWrittenFile = true;
hunk ./src/com/meapsoft/MEAPUtil.java 47
+    // All MEAPUtils need to implement this interface:
+    // void setup()  (optional - this class implements an empty version)
+    // void go()
+    // MEAPFile doit(args) - the name and return arguments of this
+    //                       function are not standardized since they all
+    //                       perform different options - see the Composer
+    //                       interface for a standard interface for Composers  
+    //                       (i.e. Segmenter has FeatFile processAudioFile(String)
+
+    public void setup() throws IOException, ParserException
+        { }
+    public abstract void go(); 
+
hunk ./src/com/meapsoft/MEAPUtil.java 239
+    }
+
+
+    /**
+     * Parse arguments common to many MEAPUtils - feature extractors
+     */
+    public static Vector parseFeatureExtractor(String[] args)
+    {
+        return MEAPUtil.parseFeatureExtractor(args, "f:");
hunk ./src/com/meapsoft/MashupComposer.java 30
-    public void printUsageAndExit() 
+    public MashupComposer(String featFN, String DBFN, String outFN)
hunk ./src/com/meapsoft/MashupComposer.java 32
-        System.out.println("Usage: MashupComposer [-options] dest.feat chunkdb.feat \n\n" + 
-		       "  where options include:\n" + 
-		       "    -o output_file  the file to write the output to (defaults to mashup.edl)");
-        printCommandLineOptions('i');
-        printCommandLineOptions('d');
-        System.out.println();
-        System.exit(0);
+        this(featFN, DBFN, outFN, new EuclideanDist());
hunk ./src/com/meapsoft/MashupComposer.java 40
+    public MashupComposer(FeatFile featFN, FeatFile DBFN, EDLFile outFN)
+    {
+        this(featFN, DBFN, outFN, new EuclideanDist());
+    }
+
hunk ./src/com/meapsoft/MashupComposer.java 57
+    public void printUsageAndExit() 
+    {
+        System.out.println("Usage: MashupComposer [-options] dest.feat chunkdb.feat \n\n" + 
+		       "  where options include:\n" + 
+		       "    -o output_file  the file to write the output to (defaults to mashup.edl)");
+        printCommandLineOptions('i');
+        printCommandLineOptions('d');
+        System.out.println();
+        System.exit(0);
+    }
+
hunk ./src/com/meapsoft/MashupComposer.java 115
-    public void setup() 
+    public void setup() throws IOException, ParserException
hunk ./src/com/meapsoft/MashupComposer.java 117
-        try
-        {
+        super.setup();
+
+        if(!dstFile.haveReadFile)
hunk ./src/com/meapsoft/MashupComposer.java 121
+        if(!DBFile.haveReadFile)
hunk ./src/com/meapsoft/MashupComposer.java 123
-        }
-        catch(Exception e)      
-        {
-            e.printStackTrace();
-            System.exit(1);
-        } 
hunk ./src/com/meapsoft/MashupComposer.java 124
-        if(dstFile.chunks.size() == 0 || DBFile.chunks.size() == 0)
-        {
-            System.out.println("Error: Empty feature file");
-            System.exit(1);
-        }
+        if(dstFile.chunks.size() == 0)  
+            throw new ParserException(dstFile.filename, "No chunks found");
+        if(DBFile.chunks.size() == 0)
+            throw new ParserException(DBFile.filename, "No chunks found");
hunk ./src/com/meapsoft/MashupComposer.java 161
+
+        // outFile now contains some chunks.
+        outFile.haveReadFile = true;
hunk ./src/com/meapsoft/MinHeap.java 58
+        
+        // this just so happens to maintain the min-heap property
+        isHeap = true;
hunk ./src/com/meapsoft/NNComposer.java 21
-    public void printUsageAndExit() 
+    public NNComposer(String featFN, String outFN)
+    {
+        super(featFN, outFN);
+    }
+
+    public NNComposer(FeatFile featFN, EDLFile outFN)
hunk ./src/com/meapsoft/NNComposer.java 28
-        System.out.println("Usage: NNComposer [-options] features.feat \n\n" + 
-		       "  where options include:\n" + 
-		       "    -o output_file  the file to write the output to (defaults to sorted.edl)\n" +
-               "    -g              debug mode (prints out chunk features on each line of output file)");
-        printCommandLineOptions('i');
-        printCommandLineOptions('d');
-        System.out.println();
-        System.exit(0);
+        super(featFN, outFN);
hunk ./src/com/meapsoft/NNComposer.java 39
+    }
+
+    public void printUsageAndExit() 
+    {
+        System.out.println("Usage: NNComposer [-options] features.feat \n\n" + 
+		       "  where options include:\n" + 
+		       "    -o output_file  the file to write the output to (defaults to sorted.edl)\n" +
+               "    -g              debug mode (prints out chunk features on each line of output file)");
+        printCommandLineOptions('i');
+        printCommandLineOptions('d');
+        System.out.println();
+        System.exit(0);
hunk ./src/com/meapsoft/NNComposer.java 99
+        // outFile now contains some chunks.
+        outFile.haveReadFile = true;
+
hunk ./src/com/meapsoft/NNComposer.java 109
-        m.go();
+
+        try
+        {
+            m.go();
+        }
+        catch(Exception e)
+        {
+            e.printStackTrace();
+            System.exit(1);
+        }
+
hunk ./src/com/meapsoft/ParserException.java 15
+
+    ParserException(String filename, String msg)
+    {
+        super("Parse error in "+filename+": "+msg);
+    }
hunk ./src/com/meapsoft/SegmentExtractor.java 69
-            outFile.chunks.add(new Chunk(sourceFileName, 
+            outFile.chunks.add(new FeatChunk(sourceFileName, 
hunk ./src/com/meapsoft/SegmentExtractor.java 87
-            outFile.chunks.add(new Chunk(sourceFileName, 
+            outFile.chunks.add(new FeatChunk(sourceFileName, 
hunk ./src/com/meapsoft/Segmenter.java 33
-    public void printUsageAndExit() 
-    {
-        System.out.println("Usage: Segmenter [-options] source1.wav source2.mp3 ... \n\n" + 
-               "  where options include:\n" + 
-		       "    -o output_file  the file to write the output to (defaults to ./out.segments)\n" +
-		       "    -m N      [0]   use mixer N for input\n" +
-		       "    -b D.D  [2.0]   fraction of the band mean needed to trigger a band onset\n" +
-		       "    -f D.D   [.3]   fraction of bands that need to onset for a global onset\n" +
-               "    -d              use the old style onset detector (defaults to BeatOnsetDetector)\n" +
-               "    -0              add an onset at the very beginning of the file\n" +
-		       "");
-        System.exit(0);
-    }
-
hunk ./src/com/meapsoft/Segmenter.java 61
+    public Segmenter(String inFile, String outputFile, int mixer, double bandThr, double bandFr, boolean beatOD, boolean oaff)
+    {
+        this(inFile, outputFile);
+
+        mixerToUse = mixer;
+        bandThresh = bandThr;
+        bandFrac = bandFr;
+        useBeatOD = beatOD;
+        onsetAtFirstFrame = oaff;
+    }
+
+    public void printUsageAndExit() 
+    {
+        System.out.println("Usage: Segmenter [-options] source1.wav source2.mp3 ... \n\n" + 
+               "  where options include:\n" + 
+		       "    -o output_file  the file to write the output to (defaults to ./out.segments)\n" +
+		       "    -m N      [0]   use mixer N for input\n" +
+		       "    -b D.D  [2.0]   fraction of the band mean needed to trigger a band onset\n" +
+		       "    -f D.D   [.3]   fraction of bands that need to onset for a global onset\n" +
+               "    -d              use the old style onset detector (defaults to BeatOnsetDetector)\n" +
+               "    -0              add an onset at the very beginning of the file\n" +
+		       "");
+        System.exit(0);
+    }
+
hunk ./src/com/meapsoft/Segmenter.java 141
+    public FeatFile processAudioFile()
+    {
+        return processAudioFile(outFile.filename);
+    }
+
hunk ./src/com/meapsoft/Segmenter.java 169
+        // outFile now contains some chunks.
+        outFile.haveReadFile = true;
+
hunk ./src/com/meapsoft/Segmenter.java 175
+    /**
+     * Set everything up, process input, and write output.
+     */
hunk ./src/com/meapsoft/SortComposer.java 28
-    public void printUsageAndExit() 
+    public SortComposer(String featFN, String outFN)
hunk ./src/com/meapsoft/SortComposer.java 30
-        System.out.println("Usage: SortComposer [-options] features.feat \n\n" + 
-               "  where options include:\n" + 
-               "    -o output_file  the file to write the output to (defaults to sorted.edl)\n" +
-               "    -g              debug mode (prints out chunk features on each line of output file)\n" +
-               "    -r              sort in reverse order");
-        printCommandLineOptions('i');
-        printCommandLineOptions('d');
-        System.out.println();
-        System.exit(0);
+        this(featFN, outFN, new EuclideanDist());
hunk ./src/com/meapsoft/SortComposer.java 33
+    public SortComposer(FeatFile featFN, EDLFile outFN)
+    {
+        this(featFN, outFN, new EuclideanDist());
+    }
hunk ./src/com/meapsoft/SortComposer.java 54
+    public void printUsageAndExit() 
+    {
+        System.out.println("Usage: SortComposer [-options] features.feat \n\n" + 
+               "  where options include:\n" + 
+               "    -o output_file  the file to write the output to (defaults to sorted.edl)\n" +
+               "    -g              debug mode (prints out chunk features on each line of output file)\n" +
+               "    -r              sort in reverse order");
+        printCommandLineOptions('i');
+        printCommandLineOptions('d');
+        System.out.println();
+        System.exit(0);
+    }
+
hunk ./src/com/meapsoft/SortComposer.java 120
-    public void setup()
+    public void setReverseSort(boolean b)
hunk ./src/com/meapsoft/SortComposer.java 122
-        try
-        {
+        reverseSort = b;
+    }
+
+    public void setup() throws IOException, ParserException
+    {
+        super.setup();
+
+        if(!featFile.haveReadFile)
hunk ./src/com/meapsoft/SortComposer.java 131
-        }
-        catch(Exception e)      
-        {
-            e.printStackTrace();
-            System.exit(1);
-        } 
hunk ./src/com/meapsoft/SortComposer.java 133
-        {
-            System.out.println("Error: Empty feature file");
-            System.exit(1);
-        }
+            throw new ParserException(featFile.filename, "No chunks found");
hunk ./src/com/meapsoft/SortComposer.java 189
+
+        // outFile now contains some chunks.
+        outFile.haveReadFile = true;
hunk ./src/com/meapsoft/Synthesizer.java 27
-
-    // \todo{test output to line out}
-    public void printUsageAndExit() 
-    {
-        System.out.println("Usage: Synthesizer [-options] file.edl \n\n" + 
-                           "  where options include:\n" + 
-                           "    -o output_file  output sound file (defaults to line out)\n" +
-                           "");
-        System.exit(0);
-    }
-
hunk ./src/com/meapsoft/Synthesizer.java 38
+    // \todo{test output to line out}
+    public void printUsageAndExit() 
+    {
+        System.out.println("Usage: Synthesizer [-options] file.edl \n\n" + 
+                           "  where options include:\n" + 
+                           "    -o output_file  output sound file (defaults to line out)\n" +
+                           "");
+        System.exit(0);
+    }
+
hunk ./src/com/meapsoft/Synthesizer.java 84
+    public void setup() throws IOException, ParserException
+    {
+        if(!edlFile.haveReadFile)
+            edlFile.readFile();
+
+        if(edlFile.chunks.size() == 0)
+            throw new ParserException(edlFile.filename, "No chunks found");
+    }
+
hunk ./src/com/meapsoft/Synthesizer.java 98
-        // outSamples should probably be initialized properly...
+        // initialize outSamples properly
hunk ./src/com/meapsoft/Synthesizer.java 126
+            // Smooth out any rough edges to the data with a simple triangular
+            // window on each end
+            // int winSize = ;
+            //for(int i=0; i<winSize; i++) 
+            //{
+            //    chunkSamples[i] *= (double)i / (double)winSize;
+            //    chunkSamples[samples.length-1-i] *= (double)i / (double)winSize;
+            //}    
+
hunk ./src/com/meapsoft/Synthesizer.java 136
-            {
-                // Smooth out any rough edges to the data with a simple triangular
-                // window on each end
-                // int winSize = ;
-                //for(int i=0; i<winSize; i++) 
-                //{
-                //    chunkSamples[i] *= (double)i / (double)winSize;
-                //    chunkSamples[samples.length-1-i] *= (double)i / (double)winSize;
-                //}    
-                
-               outSamples[offset + x] += chunkSamples[x];
-           }
-        }    
+                outSamples[offset + x] += chunkSamples[x];
+        }
hunk ./src/com/meapsoft/Synthesizer.java 140
+    /**
+     * Set everything up, process input, and write output.
+     */
hunk ./src/com/meapsoft/Synthesizer.java 149
-            edlFile.readFile();
+            setup();
hunk ./src/com/meapsoft/featextractors/AvgSpec.java 7
- * a single vector.
+ * a single vector.  This computes the mean in linear magnitude and
+ * then returns the result in log magnitude.
hunk ./src/com/meapsoft/featextractors/AvgSpec.java 30
-                double tmp = curFrame[band] / length;
+                //double tmp = curFrame[band] / length;
+                double tmp = Math.pow(10,curFrame[band]/10) / length;
hunk ./src/com/meapsoft/featextractors/AvgSpec.java 37
+        double dBconst = 10/Math.log(10); 
hunk ./src/com/meapsoft/featextractors/AvgSpec.java 39
-            avgSpec[band] = avgSpec[band] / sum;
+            //avgSpec[band] = avgSpec[band] / sum;
+            avgSpec[band] = dBconst*Math.log(avgSpec[band] / sum);
addfile ./src/com/meapsoft/featextractors/GeometricAvgSpec.java
hunk ./src/com/meapsoft/featextractors/GeometricAvgSpec.java 1
+package com.meapsoft.featextractors;
+
+import com.meapsoft.STFT;
+
+/**
+ * A simple feature calculation that computes the geometric mean
+ * (arithmetic mean in log magnitude) of all spectral frames into a
+ * single vector.  This is probably not an especially useful feature.
+ *
+ * @author Mike Mandel (mim@ee.columbia.edu)
+ */
+
+public class GeometricAvgSpec implements FeatureExtractor 
+{
+    public double[] features(STFT stft, long startFrame, int length) 
+    {
+
+        double[] avgSpec= new double[stft.getRows()];
+        double[] curFrame;
+        double sum = 0;
+        
+        for(int band=0; band<avgSpec.length; band++)
+            avgSpec[band] = 0;
+        
+        for(int frame=0; frame<length; frame++) 
+        {
+            curFrame = stft.getFrame(startFrame+frame);
+            for(int band=0; band<avgSpec.length; band++) 
+            {
+                double tmp = curFrame[band] / length;
+                avgSpec[band] += tmp;
+                sum += tmp;
+            }
+        }
+
+        for(int band=0; band<avgSpec.length; band++)
+            avgSpec[band] = avgSpec[band] / sum;
+        
+        return avgSpec;
+    }
+}
hunk ./src/com/meapsoft/gui/ImagePanel.java 39
-    JLabel status;
+    JLabel statusbar;
hunk ./src/com/meapsoft/gui/ImagePanel.java 79
-        featFile.readFile();
+        if(!featFile.haveReadFile)
+            featFile.readFile();
hunk ./src/com/meapsoft/gui/ImagePanel.java 144
-        status = new JLabel("");
-        add(status, BorderLayout.SOUTH);
+        statusbar = new JLabel(featFile.filename);
+        add(statusbar, BorderLayout.SOUTH);
hunk ./src/com/meapsoft/gui/ImagePanel.java 178
-                                        .getPreferredSize().getHeight());
+                                        .getPreferredSize().getHeight()
+                              - statusbar.getPreferredSize().getHeight()
+                              - toolbar.getPreferredSize().getHeight());
hunk ./src/com/meapsoft/gui/ImagePanel.java 203
-            status.setText(featFile.filename + ": features(" + x + "," + y 
+            statusbar.setText(featFile.filename + ": features(" + x + "," + y 
}
