-
-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f9e82d
commit d877991
Showing
5 changed files
with
295 additions
and
72 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
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
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,35 @@ | ||
/** | ||
* Control the level of an envelope | ||
*/ | ||
|
||
var env; // this is the env | ||
var osc; // this oscillator will modulate the amplitude of the carrier | ||
var freqEnv; // env for frequency | ||
|
||
function setup() { | ||
env = new p5.Env(); | ||
env.setADSR(0.01, 0.2, 0.2, 0.3); | ||
env.setRange(0, 1); | ||
|
||
freqEnv = new p5.Env(); | ||
freqEnv.setADSR(0.01, 0.2, 0.2, 0.3); | ||
freqEnv.setRange(300, 5000); | ||
|
||
|
||
osc = new p5.Oscillator(); // connects to master output by default | ||
osc.start(0); | ||
osc.freq(220); | ||
// osc.freq(env.scale(0,1,800,300)); | ||
osc.freq(freqEnv); | ||
osc.amp(env); | ||
} | ||
|
||
function mousePressed() { | ||
env.triggerAttack(); | ||
freqEnv.triggerAttack(); | ||
} | ||
|
||
function mouseReleased() { | ||
env.triggerRelease(); | ||
freqEnv.triggerRelease(); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.