[fixed a few featureextractors
ronw@ee.columbia.edu**20060320215122] {
hunk ./examples/make_psycho_stairway.sh 13
-$JAVA FeatExtractor -f avgmelspec mashup_stairway.feat
-
hunk ./examples/make_psycho_stairway.sh 14
-$JAVA FeatExtractor -f avgmelspec mashup_psycho_killer.feat
+$JAVA FeatExtractor -f avgmelspec mashup_stairway.feat mashup_psycho_killer.feat
hunk ./examples/reorder_stairway.sh 11
-$JAVA FeatExtractor -f avgpower -f avgspeccentroid -o stairway.feat stairway.segments
+$JAVA FeatExtractor -f avgpower -f avgspeccentroid -f avgspecflatness -o stairway.feat stairway.segments
hunk ./examples/reorder_stairway.sh 29
+
+#perl sort_composer.pl -d 4 stairway.feat stairway_sortasc.edl
+#$JAVA Synthesizer -o stairway_sortasc.wav stairway_sortasc.edl
hunk ./src/MEAPUtil.java 13
-    int numChannels = 1;
-    int bitsPerSamp = 16;
-    int samplingRate = 44100;
-    boolean signed = true;
-    boolean bigEndian = false;
-    AudioFormat stereo = new AudioFormat(samplingRate, bitsPerSamp, 2, 
+    static int numChannels = 1;
+    static int bitsPerSamp = 16;
+    static int samplingRate = 44100;
+    static boolean signed = true;
+    static boolean bigEndian = false;
+    static AudioFormat stereo = new AudioFormat(samplingRate, bitsPerSamp, 2, 
hunk ./src/MEAPUtil.java 106
-            //stream = AudioSystem.getAudioInputStream(stereo, stream);
+            //stream = AudioSystem.getAudioInputStream(MEAPUtil.stereo, stream);
hunk ./src/featextractors/AvgMelSpec.java 3
+import java.util.*;
+
hunk ./src/featextractors/AvgMelSpec.java 59
-    for(int band=0; band<linSpec.length; band++)
-      linSpec[band] = 0;
+    Arrays.fill(linSpec, 0);
hunk ./src/featextractors/AvgMelSpec.java 65
-	linSpec[band] += curFrame[band] / length;
+        linSpec[band] += curFrame[band] / length;
hunk ./src/featextractors/AvgMelSpec.java 70
-      linSpec[band] = Math.exp(linSpec[band]);
+      //linSpec[band] = Math.exp(linSpec[band]);
+      linSpec[band] = Math.pow(10,linSpec[band]/10);
hunk ./src/featextractors/AvgMelSpec.java 73
-    // convert to mel scale (should exponentiate first?)
+    // convert to mel scale
hunk ./src/featextractors/AvgSpecCentroid.java 24
+                // convert back to linear power
+                double p = Math.pow(10,curFrame[band]/10);
hunk ./src/featextractors/AvgSpecCentroid.java 27
-                num += freqCenter*curFrame[band];
-                den += curFrame[band];
+                num += freqCenter*p;
+                den += p;
hunk ./src/featextractors/AvgSpecFlatness.java 15
-        double den = 0;
+        double den = Double.MIN_VALUE;
hunk ./src/featextractors/AvgSpecFlatness.java 21
-            num = 1; den = 0;
+            num = 0; den = 0;
+            int nband = stft.getRows();
hunk ./src/featextractors/AvgSpecFlatness.java 24
-            for(int band=0; band<stft.getRows(); band++) 
+            for(int band = 0; band < nband; band++) 
hunk ./src/featextractors/AvgSpecFlatness.java 26
-                num *= curFrame[band];
-                den += curFrame[band];
+                // convert back to linear power
+                double p = Math.pow(10,curFrame[band]/10);
+
+                num += Math.log(p)/nband;
+                den += p/nband;
hunk ./src/featextractors/AvgSpecFlatness.java 32
-            avgSpecFlatness[0] += num/(length*den);
+            avgSpecFlatness[0] += Math.exp(num)/(den*length);
hunk ./src/featextractors/TimeFreqCentroid.java 26
+                // convert back to linear power
+                double p = Math.pow(10,curFrame[band]/10);
hunk ./src/featextractors/TimeFreqCentroid.java 29
-                num0 += timeCenter*curFrame[band];
-                num1 += freqCenter*curFrame[band];
-                den += curFrame[band];
+                num0 += timeCenter*p;
+                num1 += freqCenter*p;
+                den += p;
}
