Skip to content

Commit 4a6c042

Browse files
committed
AllPass examples code style fixes and re-use examples for other methods
1 parent 8c4f9bf commit 4a6c042

4 files changed

Lines changed: 74 additions & 18 deletions

File tree

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
// Create two triangle waves with deconstructive frequencies.
2-
triA = new TriOsc(this);
3-
triA.freq(220);
4-
triB = new TriOsc(this);
5-
triB.freq(410);
1+
import processing.sound.*;
62

7-
// Make an Allpass
8-
allPass = new AllPass(this);
9-
// Give Allpass a high gain to process yucky transience.
10-
allPass.gain(0.995);
3+
void setup() {
4+
// Create two triangle waves with deconstructive frequencies.
5+
TriOsc triA = new TriOsc(this);
6+
triA.freq(220);
7+
TriOsc triB = new TriOsc(this);
8+
triB.freq(410);
119

12-
// Start both triangle waves together.
13-
// This will create a lot of unbridled bright sounds.
14-
triA.play();
15-
triB.play();
16-
// Processing the sound through this high gained Allpass will warm it up!
17-
allPass.process(triA);
18-
allPass.process(triB);
10+
// Make an Allpass
11+
AllPass allPass = new AllPass(this);
12+
// Give Allpass a high gain to process yucky transience.
13+
allPass.gain(0.995);
14+
15+
// Start both triangle waves together.
16+
// This will create a lot of unbridled bright sounds.
17+
triA.play();
18+
triB.play();
19+
// Processing the sound through this high gained Allpass will warm it up!
20+
allPass.process(triA);
21+
allPass.process(triB);
22+
}
23+
24+
void draw() {
25+
}

content/references/examples/sound/AllPass/AllPass_1.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SawOsc saw;
44
AllPass allPass;
55

66
void setup() {
7-
size(100,100)
7+
size(100, 100);
88

99
// Create a sawtooth wave and an AllPass filter
1010
saw = new SawOsc(this);
@@ -18,7 +18,7 @@ void setup() {
1818

1919
void draw() {
2020
// Set the drive of the allPass with the mouse
21-
float g = map(mouseX, 0, width, 0., 1.);
21+
float g = map(mouseX, 0, width, 0, 1);
2222
allPass.gain(g);
2323
background(g * 255, 0, 0);
2424
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import processing.sound.*;
2+
3+
SawOsc saw;
4+
AllPass allPass;
5+
6+
void setup() {
7+
size(100, 100);
8+
9+
// Create a sawtooth wave and an AllPass filter
10+
saw = new SawOsc(this);
11+
saw.freq(200);
12+
allPass = new AllPass(this);
13+
14+
// Start the saw wave and push it through the allpass
15+
saw.play();
16+
allPass.process(saw);
17+
}
18+
19+
void draw() {
20+
// Set the drive of the allPass with the mouse
21+
float g = map(mouseX, 0, width, 0, 1);
22+
allPass.gain(g);
23+
background(g * 255, 0, 0);
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import processing.sound.*;
2+
3+
void setup() {
4+
// Create two triangle waves with deconstructive frequencies.
5+
TriOsc triA = new TriOsc(this);
6+
triA.freq(220);
7+
TriOsc triB = new TriOsc(this);
8+
triB.freq(410);
9+
10+
// Make an Allpass
11+
AllPass allPass = new AllPass(this);
12+
// Give Allpass a high gain to process yucky transience.
13+
allPass.gain(0.995);
14+
15+
// Start both triangle waves together.
16+
// This will create a lot of unbridled bright sounds.
17+
triA.play();
18+
triB.play();
19+
// Processing the sound through this high gained Allpass will warm it up!
20+
allPass.process(triA);
21+
allPass.process(triB);
22+
}
23+
24+
void draw() {
25+
}

0 commit comments

Comments
 (0)