mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
defaulted start values for SoundObject
updated + reorganized examples changed process() to analyze for analyzers changed play() to process() for effects
This commit is contained in:
@@ -13,7 +13,7 @@ Amplitude rms;
|
||||
int scale=1;
|
||||
|
||||
public void setup() {
|
||||
size(350,350);
|
||||
size(640,360);
|
||||
|
||||
// Create and start the sound renderer
|
||||
stream = new Sound(this, 44100, 512);
|
||||
@@ -30,7 +30,7 @@ public void setup() {
|
||||
public void draw() {
|
||||
background(125,255,125);
|
||||
|
||||
// rms.process() return a value between 0 and 1. To adjust
|
||||
// rms.analyze() return a value between 0 and 1. To adjust
|
||||
// the scaling and mapping of an ellipse we scale from 0 to 0.5
|
||||
scale=int(map(rms.process(), 0, 0.5, 1, 350));
|
||||
noStroke();
|
||||
|
||||
@@ -13,10 +13,10 @@ FFT fft;
|
||||
|
||||
int scale=1;
|
||||
int bands=512;
|
||||
float[] spec = new float[bands];
|
||||
float[] spectrum = new float[bands];
|
||||
|
||||
public void setup() {
|
||||
size(bands,350);
|
||||
size(bands,360);
|
||||
background(255);
|
||||
|
||||
// Create and start the sound renderer
|
||||
@@ -35,7 +35,7 @@ public void setup() {
|
||||
public void draw() {
|
||||
background(255);
|
||||
|
||||
fft.process(spec);
|
||||
fft.analyze(spectrum);
|
||||
|
||||
for(int i = 0; i < bands; i++)
|
||||
{
|
||||
@@ -44,4 +44,3 @@ public void draw() {
|
||||
line( i, height, i, height - spec[i]*height*5 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user