mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-06 17:08:48 +00:00
70 lines
No EOL
1.5 KiB
HTML
70 lines
No EOL
1.5 KiB
HTML
<html>
|
|
<head>
|
|
<title>TRANSPORT</title>
|
|
|
|
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
|
|
<script type="text/javascript" src="../deps/require.js"></script>
|
|
</head>
|
|
<body>
|
|
<button>start</button>
|
|
<div id="output"></div>
|
|
<script type="text/javascript">
|
|
require.config({
|
|
baseUrl : "../"
|
|
});
|
|
|
|
require(["Tone/core/Tone", "Tone/core/Master", "Tone/core/Transport", "Tone/source/Player"], function(Tone){
|
|
|
|
|
|
Tone.Transport.loop = true;
|
|
Tone.Transport.setLoopStart("0:0");
|
|
Tone.Transport.setLoopEnd("1:0");
|
|
Tone.Transport.setBpm(145);
|
|
|
|
var player = new Tone.Player("../audio/505/hh.mp3");
|
|
player.toMaster();
|
|
player.load();
|
|
|
|
Tone.Transport.setTimeout(function(time){
|
|
player.start(time);
|
|
$("#output").html("a");
|
|
}, "0:0");
|
|
|
|
Tone.Transport.setTimeout(function(time){
|
|
player.start(time);
|
|
$("#output").html("series");
|
|
}, "0:1");
|
|
|
|
Tone.Transport.setTimeout(function(time){
|
|
player.start(time);
|
|
$("#output").html("of");
|
|
}, "2n");
|
|
|
|
Tone.Transport.setTimeout(function(time){
|
|
player.start(time);
|
|
$("#output").html("timed");
|
|
}, "0:3");
|
|
|
|
Tone.Transport.setTimeout(function(time){
|
|
player.start(time);
|
|
$("#output").html("events");
|
|
}, "0:3:2");
|
|
|
|
$("button").click(function(){
|
|
if (Tone.Transport.state === "playing"){
|
|
Tone.Transport.stop(0);
|
|
$("button").html("start");
|
|
} else {
|
|
Tone.Transport.start(0);
|
|
$("button").html("stop");
|
|
}
|
|
})
|
|
|
|
window.Tone = Tone;
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html> |