public final class PitchFunctions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PitchFunctions.EportType |
Modifier and Type | Method and Description |
---|---|
static void |
bandwithFilter(java.util.List<java.lang.Double> pitchValuesInHertz,
double minValueInHertz,
double maxValueInHertz)
Removes all frequencies that are not in the specified band.
|
static java.util.List<java.lang.Double> |
convertHertzTo(PitchUnit unit,
java.util.List<java.lang.Double> pitchValuesInHertz)
Converts pitches in Hertz to the requested unit.
|
static Histogram |
createFrequencyTable(java.util.List<java.lang.Double> values,
double classWidth,
double start,
double stop)
Creates a frequency table.
|
static void |
exportFrequencyTable(Histogram histogram,
java.lang.String fileName) |
static void |
exportFrequencyTable(Histogram histogram,
java.lang.String fileName,
double start,
double stop) |
static java.util.List<java.lang.Double> |
gaussianFilter(java.util.List<java.lang.Double> listToFilter)
Applies a Gaussian filter to the list to filter.
|
static java.util.List<java.lang.Double> |
gaussianFilter(java.util.List<java.lang.Double> listToFilter,
double parameter)
Applies a Gaussian filter to the list to filter.
|
static java.util.List<java.lang.Double> |
getGaussianSmoothed(java.util.List<java.lang.Double> listToSmooth,
double standardDeviation)
Smooths a list of doubles using a gaussian.
|
static java.lang.Double |
median(java.util.List<java.lang.Double> list)
Calculates the median for a list of doubles.
|
static java.util.List<java.lang.Double> |
medianFilter(java.util.List<java.lang.Double> listToFilter,
int n)
Applies an order n one-dimensional median filter to the list to filter.
|
static Histogram |
readFrequencyTable(java.lang.String fileName)
Reads a frequency table (histogram) from disk.
|
public static java.util.List<java.lang.Double> convertHertzTo(PitchUnit unit, java.util.List<java.lang.Double> pitchValuesInHertz)
unit
- The unit to convert from.pitchValuesInHertz
- The list of values to convert.public static void bandwithFilter(java.util.List<java.lang.Double> pitchValuesInHertz, double minValueInHertz, double maxValueInHertz)
pitchValuesInHertz
- the values to filter.minValueInHertz
- the minimum frequency in Hertz.maxValueInHertz
- the maximum frequency in Hertz.public static java.lang.Double median(java.util.List<java.lang.Double> list)
list
- The list.If
- the list is null or empty the median is undefined and an
error is thrown.public static java.util.List<java.lang.Double> medianFilter(java.util.List<java.lang.Double> listToFilter, int n)
Applies an order n one-dimensional median filter to the list to filter. The function considers the signal to be 0 beyond the end points. The output has the same length as the list to filter.
Returns a new list.
n must be odd! The function is defined as:
f(bufferCount) = median( list(bufferCount-n/2) .. list(bufferCount+n/2) )
So for n = 3 and list to filter: [3 7 4] 0 [3 7 4] 0 [3 4 7]
listToFilter
- The list to filter.n
- An odd number. The order n of the one-dimensional median
filter. An IllegalArgumentException is thrown when n is even.public static java.util.List<java.lang.Double> getGaussianSmoothed(java.util.List<java.lang.Double> listToSmooth, double standardDeviation)
listToSmooth
- the list to smoothstandardDeviation
- the standard deviation, 0 means return the original list,
below zero is invalid.public static java.util.List<java.lang.Double> gaussianFilter(java.util.List<java.lang.Double> listToFilter, double parameter)
listToFilter
- the list to filterparameter
- the parameter defining the impulse response of the filter.public static java.util.List<java.lang.Double> gaussianFilter(java.util.List<java.lang.Double> listToFilter)
listToFilter
- the list to filterpublic static Histogram createFrequencyTable(java.util.List<java.lang.Double> values, double classWidth, double start, double stop)
values
- the data to distribute over the bins/classes.classWidth
- the resolution or the with of the classesstart
- the starting valuestop
- the stopping valuepublic static void exportFrequencyTable(Histogram histogram, java.lang.String fileName, double start, double stop)
public static void exportFrequencyTable(Histogram histogram, java.lang.String fileName)
public static Histogram readFrequencyTable(java.lang.String fileName)
value;frequency[;other data; is discarded;...]
The lowest
value is on the first row, the highest on the last!fileName
-