forked from processing/processing-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request processing#536 from processing/sound-updates
Sound updates
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import processing.sound.*; | ||
|
||
void setup() { | ||
// Create two triangle waves with deconstructive frequencies. | ||
TriOsc triA = new TriOsc(this); | ||
triA.freq(220); | ||
TriOsc triB = new TriOsc(this); | ||
triB.freq(410); | ||
|
||
// Make an Allpass | ||
AllPass allPass = new AllPass(this); | ||
// Give Allpass a high gain to process yucky transience. | ||
allPass.gain(0.995); | ||
|
||
// Start both triangle waves together. | ||
// This will create a lot of unbridled bright sounds. | ||
triA.play(); | ||
triB.play(); | ||
// Processing the sound through this high gained Allpass will warm it up! | ||
allPass.process(triA); | ||
allPass.process(triB); | ||
} | ||
|
||
void draw() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import processing.sound.*; | ||
|
||
SawOsc saw; | ||
AllPass allPass; | ||
|
||
void setup() { | ||
size(100, 100); | ||
|
||
// Create a sawtooth wave and an AllPass filter | ||
saw = new SawOsc(this); | ||
saw.freq(200); | ||
allPass = new AllPass(this); | ||
|
||
// Start the saw wave and push it through the allpass | ||
saw.play(); | ||
allPass.process(saw); | ||
} | ||
|
||
void draw() { | ||
// Set the drive of the allPass with the mouse | ||
float g = map(mouseX, 0, width, 0, 1); | ||
allPass.gain(g); | ||
background(g * 255, 0, 0); | ||
} |
24 changes: 24 additions & 0 deletions
24
content/references/examples/sound/AllPass_gain_/AllPass_gain_0.pde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import processing.sound.*; | ||
|
||
SawOsc saw; | ||
AllPass allPass; | ||
|
||
void setup() { | ||
size(100, 100); | ||
|
||
// Create a sawtooth wave and an AllPass filter | ||
saw = new SawOsc(this); | ||
saw.freq(200); | ||
allPass = new AllPass(this); | ||
|
||
// Start the saw wave and push it through the allpass | ||
saw.play(); | ||
allPass.process(saw); | ||
} | ||
|
||
void draw() { | ||
// Set the drive of the allPass with the mouse | ||
float g = map(mouseX, 0, width, 0, 1); | ||
allPass.gain(g); | ||
background(g * 255, 0, 0); | ||
} |
25 changes: 25 additions & 0 deletions
25
content/references/examples/sound/AllPass_process_/AllPass_process_0.pde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import processing.sound.*; | ||
|
||
void setup() { | ||
// Create two triangle waves with deconstructive frequencies. | ||
TriOsc triA = new TriOsc(this); | ||
triA.freq(220); | ||
TriOsc triB = new TriOsc(this); | ||
triB.freq(410); | ||
|
||
// Make an Allpass | ||
AllPass allPass = new AllPass(this); | ||
// Give Allpass a high gain to process yucky transience. | ||
allPass.gain(0.995); | ||
|
||
// Start both triangle waves together. | ||
// This will create a lot of unbridled bright sounds. | ||
triA.play(); | ||
triB.play(); | ||
// Processing the sound through this high gained Allpass will warm it up! | ||
allPass.process(triA); | ||
allPass.process(triB); | ||
} | ||
|
||
void draw() { | ||
} |