Tone.js/examples/player.html
Yotam Mann 97e60e11cf updated looping API
removed “loop” method
2014-06-25 13:11:29 -04:00

40 lines
No EOL
882 B
HTML

<html>
<head>
<title>Basic Player</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>
<div>press and hold the button to play a 10ms grain from the audio file</div>
<br>
<button>start</button>
<div id='loading'>loading...</button>
<script type="text/javascript">
var player = new Tone.Player("./audio/casio/A1.mp3", function(){
$("#loading").remove();
});
player.loop = true;
player.loopStart = 0.1;
player.loopEnd = 0.11;
//connect it to the output
player.toMaster();
$("button").mousedown(function(){
player.start(0, player.loopStart);
$(this).text("stop");
});
$("button").mouseup(function(){
player.stop();
$(this).text("start");
});
</script>
</body>
</html>