Processing, 類Waveform
用法介紹。
構造函數
Waveform(parent, nsamples)
參數
parent
通常使用"this"nsamples
您希望一次能夠讀取的波形樣本數(正整數)。
說明
這是一個波形分析儀。它在使用analyze()
方法查詢音頻流時返回其波形。
例子
import processing.sound.*;
SoundFile sample;
Waveform waveform;
int samples = 100;
public void setup()
{
size(640, 360);
background(255);
sample = new SoundFile(this, "beat.aiff");
sample.loop();
waveform = new Waveform(this, samples);
waveform.input(sample);
}
public void draw()
{
background(0);
stroke(255);
strokeWeight(2);
noFill();
waveform.analyze();
beginShape();
for(int i = 0; i < samples; i++)
{
vertex(
map(i, 0, samples, 0, width),
map(waveform.data[i], -1, 1, 0, height)
);
}
endShape();
}
相關用法
- Processing WhiteNoise.add()用法及代碼示例
- Processing WhiteNoise用法及代碼示例
- Processing WhiteNoise.set()用法及代碼示例
- Processing WhiteNoise.amp()用法及代碼示例
- Processing WhiteNoise.pan()用法及代碼示例
- Processing WhiteNoise.stop()用法及代碼示例
- Processing WhiteNoise.play()用法及代碼示例
- Processing FFT用法及代碼示例
- Processing SawOsc.pan()用法及代碼示例
- Processing FloatDict用法及代碼示例
- Processing FFT.stop()用法及代碼示例
- Processing join()用法及代碼示例
- Processing () (parentheses)用法及代碼示例
- Processing Pulse用法及代碼示例
- Processing PShader用法及代碼示例
- Processing PVector.set()用法及代碼示例
- Processing FloatDict.sortKeysReverse()用法及代碼示例
- Processing texture()用法及代碼示例
- Processing IntDict.add()用法及代碼示例
- Processing PShape.enableStyle()用法及代碼示例
- Processing FloatDict.sub()用法及代碼示例
- Processing String用法及代碼示例
- Processing PImage.pixels[]用法及代碼示例
- Processing vertex()用法及代碼示例
- Processing PVector.mag()用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 Waveform。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。