double Spectrum_getBandEnergy (Spectrum me, double fmin, double fmax) { /* * The computation requires that the negative-frequency values are the complex conjugates * of the positive-frequency values, and that only the positive-frequency values are included * in the spectrum. */ if (my xmin < 0.0) return NUMundefined; /* * Any energy outside [my xmin, my xmax] is ignored. * This is very important, since my xmin and my xmax determine the meaning of the first and last bins; see below. * * The width of most bins is my dx, but the first and last bins can be truncated by fmin and fmax. * * This truncation even applies in the case of autowindowing, * i.e. if the total energy in the spectrum is computed. * In that case, the first and last bins can be truncated by my xmin and my xmax. * This happens almost always for the first bin, * which is usually centred at f=0, hence has a width of 0.5 * my dx, * and quite often for the last bin as well (namely if the original sound had an even number of samples), * which is then centred at f=nyquist, hence has a width of 0.5 * my dx. * * All this truncation is automatically performed by Sampled_getMean (). */ return Sampled_getIntegral (me, fmin, fmax, 0, 1, FALSE); }
double Sampled_getIntegral_standardUnit (Sampled me, double xmin, double xmax, long ilevel, int averagingUnit, int interpolate) { return Function_convertSpecialToStandardUnit (me, Sampled_getIntegral (me, xmin, xmax, ilevel, averagingUnit, interpolate), ilevel, averagingUnit); }
double Sampled_getIntegral_standardUnit (I, double xmin, double xmax, long ilevel, int averagingUnit, int interpolate) { iam (Sampled); return ClassFunction_convertSpecialToStandardUnit (my methods, Sampled_getIntegral (me, xmin, xmax, ilevel, averagingUnit, interpolate), ilevel, averagingUnit); }