Skip to content

Commit c958f42

Browse files
authored
Merge pull request processing#536 from processing/sound-updates
Sound updates
2 parents feb5896 + d83105f commit c958f42

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed
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+
}
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: 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)