@@ -0,0 +1,914 @@
+package com.github.davidmoten.ar;%0A%0Aimport rx.functions.Func1;%0A%0A/**%0A * %3Cp%3E%0A * This function emphasizes higher frequencies in an audio signal represented by%0A * a an array of double. This has the effect of sharpening speech in particular.%0A * %3C/p%3E%0A * %0A * %3Cp%3E%0A * Audio samples %3Ca href=%0A * %22http://mirlab.org/jang/books/audiosignalprocessing/speechFeatureMfcc.asp?title=12-2%2520MFCC%22%0A * %3Ehere%3C/a%3E.%0A * %3C/p%3E%0A *%0A */%0Apublic class PreEmphasisFunction implements Func1%3Cdouble%5B%5D, double%5B%5D%3E %7B%0A%0A%09private final double proportion;%0A%0A%09public PreEmphasisFunction(double proportion) %7B%0A%09%09this.proportion = proportion;%0A%09%7D%0A%0A%09public PreEmphasisFunction() %7B%0A%09%09this(0.95);%0A%09%7D%0A%0A%09@Override%0A%09public double%5B%5D call(double%5B%5D x) %7B%0A%09%09if (x.length == 0)%0A%09%09%09return new double%5B0%5D;%0A%09%09else %7B%0A%09%09%09double%5B%5D y = new double%5Bx.length%5D;%0A%09%09%09y%5B0%5D = x%5B0%5D;%0A%09%09%09for (int i = 1; i %3C x.length; i++) %7B%0A%09%09%09%09y%5Bi%5D = x%5Bi%5D - proportion * x%5Bi - 1%5D;%0A%09%09%09%7D%0A%09%09%09return y;%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

add PreEmphasisFunction