mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
97e60e11cf
removed “loop” method
40 lines
No EOL
882 B
HTML
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> |