2014-03-15 03:17:18 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Basic Player</title>
|
2014-06-23 17:29:22 +00:00
|
|
|
|
|
|
|
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
|
2014-06-19 17:38:21 +00:00
|
|
|
<script type="text/javascript" src="../Tone.js"></script>
|
2014-06-23 17:29:22 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="exampleStyle.css">
|
|
|
|
|
2014-03-15 03:17:18 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-06-23 17:29:22 +00:00
|
|
|
<div>press and hold the button to play a 10ms grain from the audio file</div>
|
|
|
|
<br>
|
|
|
|
<button>start</button>
|
2014-04-16 00:05:11 +00:00
|
|
|
<div id='loading'>loading...</button>
|
2014-03-15 03:17:18 +00:00
|
|
|
<script type="text/javascript">
|
2014-04-06 00:47:59 +00:00
|
|
|
|
2014-06-21 22:39:01 +00:00
|
|
|
var player = new Tone.Player("./audio/casio/A1.mp3", function(){
|
2014-06-23 17:29:22 +00:00
|
|
|
$("#loading").remove();
|
2014-06-21 22:39:01 +00:00
|
|
|
});
|
2014-04-06 00:47:59 +00:00
|
|
|
|
2014-04-16 00:05:11 +00:00
|
|
|
//connect it to the output
|
|
|
|
player.toMaster();
|
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
$("button").mousedown(function(){
|
2014-04-16 00:05:11 +00:00
|
|
|
player.loop(0, .1, .11);
|
2014-06-23 17:29:22 +00:00
|
|
|
$(this).text("stop");
|
|
|
|
});
|
2014-03-15 03:17:18 +00:00
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
$("button").mouseup(function(){
|
2014-04-16 00:05:11 +00:00
|
|
|
player.stop();
|
2014-06-23 17:29:22 +00:00
|
|
|
$(this).text("start");
|
|
|
|
});
|
2014-06-20 01:48:16 +00:00
|
|
|
|
2014-03-15 03:17:18 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|