Tone.js/examples/player.html

67 lines
No EOL
1.5 KiB
HTML

<html>
<head>
<title>PLAYER</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<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>
<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">
</head>
<body>
<div id="Container">
<div id="Explanation">
Player
<br>
<br>
Press and hold to hear a 10ms grain of audio.
</div>
<div id="Content">
<div id="Loading">Loading...</div>
</div>
</div>
<script type="text/javascript">
/* globals Tone, GUI */
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();
// GUI //
new GUI.TopBar(Tone);
new GUI.Momentary($("#Content"), function(on){
if (on){
player.start();
} else {
player.stop();
}
}, "start", "stop");
</script>
<style type="text/css">
#Content {
width: 100px;
height: 50px;
}
.Momentary {
width: 100%;
}
</style>
</body>
</html>