2014-10-22 22:49:42 +00:00
|
|
|
<!DOCTYPE html>
|
2014-06-20 04:25:00 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-10-22 22:49:42 +00:00
|
|
|
<meta charset="utf-8">
|
2014-06-20 04:25:00 +00:00
|
|
|
<title>NOISES</title>
|
|
|
|
|
2014-09-06 19:35:31 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
|
|
|
2014-09-04 19:20:25 +00:00
|
|
|
<script type="text/javascript" src="./deps/jquery.min.js"></script>
|
|
|
|
<script type="text/javascript" src="./deps/jquery-ui.js"></script>
|
|
|
|
<script type="text/javascript" src="./deps/jquery.ui.touch-punch.js"></script>
|
|
|
|
<script type="text/javascript" src="../build/Tone.js"></script>
|
2014-09-04 04:06:01 +00:00
|
|
|
<script type="text/javascript" src="./Widgets.js"></script>
|
|
|
|
<script type="text/javascript" src="./ExampleList.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/widgets.css">
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/jquery-ui.css">
|
2014-06-20 04:25:00 +00:00
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
2014-09-04 04:06:01 +00:00
|
|
|
<div id="Container">
|
|
|
|
<div id="Explanation">
|
|
|
|
Noise
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
Tone has 3 different types of noise. Here's a little noise song.
|
|
|
|
</div>
|
|
|
|
<div id="Content">
|
|
|
|
<div id="Button"></div>
|
|
|
|
<div id='Noise'></div>
|
|
|
|
</div>
|
2014-06-20 04:25:00 +00:00
|
|
|
<script type="text/javascript">
|
2014-09-04 04:06:01 +00:00
|
|
|
|
|
|
|
/* globals Tone, GUI */
|
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
var noise = new Tone.Noise();
|
2014-09-06 19:35:31 +00:00
|
|
|
noise.setVolume(-20);
|
2014-06-23 17:29:22 +00:00
|
|
|
noise.toMaster();
|
2014-06-20 04:25:00 +00:00
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
var noiseTypes = ["white", "brown", "pink"];
|
2014-06-20 04:25:00 +00:00
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
Tone.Transport.setInterval(function(time){
|
|
|
|
//set a random noise type
|
|
|
|
var randomIndex = Math.floor(Math.random()* noiseTypes.length);
|
|
|
|
var randomNoise = noiseTypes[randomIndex];
|
|
|
|
noise.setType(randomNoise, time);
|
2014-09-04 04:06:01 +00:00
|
|
|
$("#Noise").text(randomNoise);
|
|
|
|
}, "8n");
|
2014-06-20 04:25:00 +00:00
|
|
|
|
2014-09-04 04:06:01 +00:00
|
|
|
//stop it after 4 measures
|
2014-06-23 17:29:22 +00:00
|
|
|
Tone.Transport.setTimeout(function(time){
|
|
|
|
noise.stop(time);
|
|
|
|
Tone.Transport.stop();
|
2014-09-04 04:06:01 +00:00
|
|
|
$("#Noise").text("done");
|
|
|
|
setTimeout(function(){
|
|
|
|
$("#Noise").text("");
|
|
|
|
}, 500);
|
|
|
|
}, "4m");
|
2014-06-20 04:25:00 +00:00
|
|
|
|
2014-09-04 04:06:01 +00:00
|
|
|
// GUI //
|
|
|
|
|
|
|
|
new GUI.TopBar(Tone);
|
|
|
|
|
|
|
|
new GUI.Momentary($("#Button"), function(){
|
2014-06-23 17:29:22 +00:00
|
|
|
Tone.Transport.start();
|
|
|
|
noise.start();
|
2014-09-04 04:06:01 +00:00
|
|
|
$("#Button").remove();
|
|
|
|
}, "start", "");
|
2014-06-20 04:25:00 +00:00
|
|
|
|
|
|
|
</script>
|
2014-09-04 04:06:01 +00:00
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
#Content {
|
|
|
|
text-align: center;
|
2014-09-06 19:35:31 +00:00
|
|
|
width: 120px;
|
2014-09-04 04:06:01 +00:00
|
|
|
}
|
2014-09-06 19:35:31 +00:00
|
|
|
#Content .Momentary{
|
|
|
|
width: 100%;
|
2014-09-04 04:06:01 +00:00
|
|
|
}
|
|
|
|
</style>
|
2014-06-20 04:25:00 +00:00
|
|
|
</body>
|
|
|
|
</html>
|