Tone.js/examples/player.html

73 lines
1.9 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2014-03-15 03:17:18 +00:00
<html>
<head>
<meta charset="utf-8">
2014-09-04 04:06:01 +00:00
<title>PLAYER</title>
2014-09-06 19:35:31 +00:00
2015-06-27 22:10:18 +00:00
<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>
2015-06-26 05:23:05 +00:00
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
2015-07-04 18:43:17 +00:00
<script type="text/javascript" src="./scripts/Notone.GUI.js"></script>
2015-02-12 03:39:28 +00:00
<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>
2014-03-15 03:17:18 +00:00
</head>
<body>
2015-02-12 03:39:28 +00:00
<div id="Content">
2015-06-26 05:23:05 +00:00
<div id="Title">Grains</div>
<div id="Explanation">
2015-06-27 22:02:55 +00:00
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.
2015-06-26 05:23:05 +00:00
</div>
2015-02-12 03:39:28 +00:00
</div>
2015-06-26 05:23:05 +00:00
<script type="text/javascript">
2015-02-12 03:39:28 +00:00
//the player
2015-06-26 05:23:05 +00:00
var player = new Tone.Player({
2015-06-27 22:02:55 +00:00
"url" : "./audio/FWDL.mp3",
2015-06-26 05:23:05 +00:00
"loop" : true,
2015-06-27 22:02:55 +00:00
"loopStart" : 0.101,
2015-06-26 05:23:05 +00:00
"loopEnd" : 0.211,
}).toMaster();
2015-02-12 03:39:28 +00:00
</script>
<script id="GUI" type="text/javascript">
2015-06-26 05:23:05 +00:00
$(function(){
Notone.config({
"search" : false,
"expandInDrawer" : true,
"hideDrawer" : Interface.isMobile,
"drawer" : true,
"container" : "body"
});
var playerGUI = Notone.add(player, "player", ["loopStart", "loopEnd"]);
2015-06-27 22:02:55 +00:00
new Interface.Loader();
new Interface.Button({
text : "Start Grain",
activeText : "Stop Grain",
2015-06-26 05:23:05 +00:00
start : function(){
2015-06-27 22:02:55 +00:00
player.start();
2015-06-26 05:23:05 +00:00
},
end : function(){
2015-06-27 22:02:55 +00:00
player.stop();
2015-06-26 05:23:05 +00:00
}
});
2015-06-27 22:02:55 +00:00
});
2014-03-15 03:17:18 +00:00
</script>
</body>
</html>