当前位置: 首页>>代码示例>>Java>>正文


Java RealDoubleFFT类代码示例

本文整理汇总了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;
}
 
开发者ID:intrepidkarthi,项目名称:UltraPush,代码行数:27,代码来源:STFT.java

示例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;
}
 
开发者ID:neurobin,项目名称:audio-analyzer-for-android,代码行数:43,代码来源:AnalyzeActivity.java


注:本文中的com.google.corp.productivity.specialprojects.android.fft.RealDoubleFFT类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。