Skip to content

Commit

Permalink
Merge pull request processing#536 from processing/sound-updates
Browse files Browse the repository at this point in the history
Sound updates
  • Loading branch information
SableRaf authored Jul 16, 2024
2 parents feb5896 + d83105f commit c958f42
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
25 changes: 25 additions & 0 deletions content/references/examples/sound/AllPass/AllPass_0.pde
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() {
}
24 changes: 24 additions & 0 deletions content/references/examples/sound/AllPass/AllPass_1.pde
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 content/references/examples/sound/AllPass_gain_/AllPass_gain_0.pde
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);
}
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() {
}

0 comments on commit c958f42

Please sign in to comment.