mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
34 lines
No EOL
729 B
HTML
34 lines
No EOL
729 B
HTML
<html>
|
|
<head>
|
|
<title>Envelope</title>
|
|
|
|
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
|
|
<script type="text/javascript" src="../Tone.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="exampleStyle.css">
|
|
</head>
|
|
<body>
|
|
|
|
<button id='Trigger'>trigger</button>
|
|
|
|
<script type="text/javascript">
|
|
var env = new Tone.Envelope(.05, .01, .4, .4);
|
|
var noise = new Tone.Noise();
|
|
|
|
//connect the evnelope to the output gain
|
|
env.connect(noise.output.gain);
|
|
|
|
//start the noise
|
|
noise.toMaster();
|
|
noise.start();
|
|
|
|
//listen for triggers
|
|
$("#Trigger").mousedown(function(){
|
|
env.triggerAttack();
|
|
});
|
|
|
|
$("#Trigger").mouseup(function(){
|
|
env.triggerRelease();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |