Tone.js/examples/player.html
2015-07-04 14:43:17 -04:00

73 lines
No EOL
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PLAYER</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript" src="../build/Tone.js"></script>
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
<script type="text/javascript" src="./scripts/Notone.GUI.js"></script>
<script type="text/javascript" src="./scripts/Interface.js"></script>
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<script type="text/javascript">
// jshint ignore: start
</script>
</head>
<body>
<div id="Content">
<div id="Title">Grains</div>
<div id="Explanation">
Click on the button to play short looped section (also called a grain)
using <a href="http://tonejs.org/docs/#Player">Tone.Player</a>.
When the loop becomes very small, it takes on another pitch value.
<br><br>
The duration of the sample is &#8275;2.5 seconds. Any values for loopStart or loopEnd
larger than the duration will just loop to the end of the sample. Also make sure
that loopStart is smaller than loopEnd.
</div>
</div>
<script type="text/javascript">
//the player
var player = new Tone.Player({
"url" : "./audio/FWDL.mp3",
"loop" : true,
"loopStart" : 0.101,
"loopEnd" : 0.211,
}).toMaster();
</script>
<script id="GUI" type="text/javascript">
$(function(){
Notone.config({
"search" : false,
"expandInDrawer" : true,
"hideDrawer" : Interface.isMobile,
"drawer" : true,
"container" : "body"
});
var playerGUI = Notone.add(player, "player", ["loopStart", "loopEnd"]);
new Interface.Loader();
new Interface.Button({
text : "Start Grain",
activeText : "Stop Grain",
start : function(){
player.start();
},
end : function(){
player.stop();
}
});
});
</script>
</body>
</html>