Revised Examples + fixed WhiteNoise Bug

This commit is contained in:
wirsing
2014-07-10 18:59:37 -07:00
parent 57f9f3c7a5
commit 1a0620d23c
7 changed files with 56 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ In this example it is started and stopped by clicking into the renderer window.
import processing.sound.*;
WhiteNoise noise;
BPF bandPass;
BandPass bPass;
float amp=0.0;
@@ -16,14 +16,14 @@ void setup() {
// Create the noise generator + Filter
noise = new WhiteNoise(this);
bandPass = new BPF(this);
bPass = new BandPass(this);
noise.play(0.5);
bandPass.process(noise, 100);
bPass.process(noise, 100);
}
void draw() {
bandPass.freq(map(mouseX, 0, 350, 20, 10000));
bPass.freq(map(mouseX, 0, 350, 20, 10000));
bandPass.res(map(mouseY, 0, 350, 0.05, 1.0));
bPass.res(map(mouseY, 0, 350, 0.05, 1.0));
}

View File

@@ -6,7 +6,7 @@ In this example it is started and stopped by clicking into the renderer window.
import processing.sound.*;
WhiteNoise noise;
HPF highPass;
HighPass highPass;
float amp=0.0;
@@ -16,12 +16,11 @@ void setup() {
// Create the noise generator + filter
noise = new WhiteNoise(this);
highPass = new HPF(this);
highPass = new HighPass(this);
noise.play(0.5);
highPass.process(noise, 100);
}
void draw() {
highPass.freq(map(mouseX, 0, 350, 20, 10000));
}

View File

@@ -6,7 +6,7 @@ In this example it is started and stopped by clicking into the renderer window.
import processing.sound.*;
WhiteNoise noise;
LPF lowPass;
LowPass lPass;
float amp=0.0;
@@ -16,11 +16,11 @@ void setup() {
// Create the noise generator + filter
noise = new WhiteNoise(this);
lowPass = new LPF(this);
noise.play(0.5);
lowPass.process(noise, 800);
lPass = new LowPass(this);
noise.play(0.2);
lPass.process(noise, 800);
}
void draw() {
lowPass.freq(map(mouseX, 0, 350, 800, 10000));
lPass.freq(map(mouseX, 0, 350, 800, 10000));
}

View File

@@ -0,0 +1,40 @@
/*
This is a sound file player.
*/
import processing.sound.*;
SoundFile soundfile;
Reverb reverb;
void setup() {
size(640,360);
background(255);
//Load a soundfile
soundfile = new SoundFile(this, "vibraphon.aiff");
// create a Delay Effect
reverb = new Reverb(this);
// Play the file in a loop
soundfile.loop();
// Set soundfile as input to the reverb
reverb.process(soundfile);
}
void draw() {
// change the roomsize of the reverb
reverb.room(map(mouseX, 0, width, 0, 1.0));
// change the high frequency dampening parameter
reverb.damp(map(mouseX, 0, width, 0, 1.0));
// change the wet/dry relation of the effect
reverb.wet(map(mouseY, 0, height, 0, 1.0));
}

View File

@@ -36,13 +36,13 @@ void draw() {
soundfile.rate(map(mouseX, 0, width, 0.25, 4.0));
// Map mouseY from 0.2 to 1.0 for amplitude
soundfile.amp(map(mouseY, 0, width, 0.2, 1.0));
soundfile.amp(map(mouseY, 0, height, 0.2, 1.0));
// Map mouseY from -1.0 to 1.0 for left to right
soundfile.pan(map(mouseY, 0, width, -1.0, 1.0));
soundfile.pan(map(mouseY, 0, height, -1.0, 1.0));
// Map mouseY from 0.001 to 2.0 seconds for the delaytime
delay.time(map(mouseY, 0, width, 0.001, 2.0));
delay.time(map(mouseY, 0, height, 0.001, 2.0));
// Map mouseX from 0 to 0.8 for the delay feedback
delay.feedback(map(mouseX, 0, width, 0.0, 0.8));

View File

@@ -20,8 +20,7 @@ public class SqrOsc implements SoundObject {
}
public void play(){
//m_nodeId = m_engine.pulsePlay(m_freq, 0.5f, m_amp*2, m_add-1, m_pos);
m_nodeId = m_engine.sqrPlay(m_freq, m_amp, m_add-1, m_pos);
m_nodeId = m_engine.sqrPlay(m_freq, m_amp, m_add-1, m_pos);
};
public void play(float freq, float amp, float add, float pos){