00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 package com.meapsoft.disgraced;
00024
00025 import com.meapsoft.STFT;
00026 import com.meapsoft.featextractors.FeatureExtractor;
00027
00035 public class ChunkPower extends FeatureExtractor
00036 {
00037 public double[] features(STFT stft, long startFrame, int length)
00038 {
00039 double[] power = new double[1];
00040 power[0] = 0;
00041 double[] samples = stft.getSamples(startFrame, startFrame+length);
00042
00043 for(int i=0; i<samples.length; i++)
00044 power[0] += samples[i]*samples[i];
00045
00046 return power;
00047 }
00048
00049 public String description()
00050 {
00051 return "Computes the total power in each chunk.";
00052 }
00053
00054 }