本文整理汇总了Java中com.google.corp.productivity.specialprojects.android.fft.RealDoubleFFT类的典型用法代码示例。如果您正苦于以下问题:Java RealDoubleFFT类的具体用法?Java RealDoubleFFT怎么用?Java RealDoubleFFT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RealDoubleFFT类属于com.google.corp.productivity.specialprojects.android.fft包,在下文中一共展示了RealDoubleFFT类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.google.corp.productivity.specialprojects.android.fft.RealDoubleFFT; //导入依赖的package包/类
private void init(int fftlen, int sampleRate, int minFeedSize, String wndName) {
if (minFeedSize <= 0) {
throw new IllegalArgumentException("STFT::init(): should minFeedSize >= 1.");
}
if (((-fftlen)&fftlen) != fftlen) {
// error: fftlen should be power of 2
throw new IllegalArgumentException("STFT::init(): Currently, only power of 2 are supported in fftlen");
}
this.sampleRate = sampleRate;
fftLen = fftlen;
spectrumAmpOutCum= new double[fftlen/2+1];
spectrumAmpOutTmp= new double[fftlen/2+1];
spectrumAmpOut = new double[fftlen/2+1];
spectrumAmpOutDB = new double[fftlen/2+1];
spectrumAmpIn = new double[fftlen];
spectrumAmpInTmp = new double[fftlen];
spectrumAmpFFT = new RealDoubleFFT(spectrumAmpIn.length);
spectrumAmpOutArray = new double[(int)Math.ceil((double)minFeedSize / (fftlen/2))][]; // /2 since half overlap
for (int i = 0; i < spectrumAmpOutArray.length; i++) {
spectrumAmpOutArray[i] = new double[fftlen/2+1];
}
initWindowFunction(fftlen, wndName);
initDBAFactor(fftlen, sampleRate);
boolAWeighting = false;
}
示例2: run
import com.google.corp.productivity.specialprojects.android.fft.RealDoubleFFT; //导入依赖的package包/类
@Override
public void run() {
final double[] fftData = new double[fftBins];
RealDoubleFFT fft = new RealDoubleFFT(fftBins);
double scale = MEAN_MAX * MEAN_MAX * fftBins * fftBins / 2d;
short[] audioSamples = new short[minBytes];
record.startRecording();
baseTimeMs = SystemClock.uptimeMillis();
while(isRunning) {
loops++;
baseTimeMs += updateMs;
int delay = (int) (baseTimeMs - SystemClock.uptimeMillis());
if (delay < 20) {
Log.i(TAG, "wait: " + delay);
}
try {
Thread.sleep(delay < 10 ? 10 : delay);
} catch (InterruptedException e) {
// Log.i(TAG, "Delay interrupted");
continue;
}
if (isTesting) {
sineGen1.getSamples(fftData);
sineGen2.addSamples(fftData);
} else {
record.read(audioSamples, 0, minBytes);
shortToDouble(audioSamples, fftData);
}
if (isPaused1) {
continue;
}
fft.ft(fftData);
convertToDb(fftData, scale);
update(fftData);
}
Log.i(TAG, "Releasing Audio");
record.stop();
record.release();
record = null;
}