当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Processing FFT.stop()用法及代码示例


Processing, 类FFT中的stop()用法介绍。

用法

  • .stop()

返回

  • void

说明

停止 FFT。

例子

import processing.sound.*;

FFT fft;
AudioIn in;
int bands = 512;
float[] spectrum = new float[bands];

void setup() {
  size(512, 360);
  background(255);
    
  // Create an Input stream which is routed into the Amplitude analyzer
  fft = new FFT(this, bands);
  in = new AudioIn(this, 0);
  
  // start the Audio Input
  in.start();
  
  // patch the AudioIn
  fft.input(in);
}      

void draw() { 
  background(255);
  fft.analyze(spectrum);

  for(int i = 0; i < bands; i++){
  // The result of the FFT is normalized
  // draw the line for frequency band i scaling it up by 5 to get more amplitude.
  line( i, height, i, height - spectrum[i]*height*5 );
  } 
}

void mousePressed() {
  in.stop();
}

相关用法


注:本文由纯净天空筛选整理自processing.org大神的英文原创作品 FFT.stop()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。