mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-15 16:17:58 +00:00
32 lines
No EOL
659 B
HTML
32 lines
No EOL
659 B
HTML
<html>
|
|
<head>
|
|
<title>Basic Player</title>
|
|
<script type="text/javascript" src="../build/Tone.js"></script>
|
|
</head>
|
|
<body>
|
|
<button>trigger</button>
|
|
<div id='loading'>loading...</button>
|
|
<script type="text/javascript">
|
|
|
|
var player = new Tone.Player("../audio/casio/A1.mp3");
|
|
|
|
//connect it to the output
|
|
player.toMaster();
|
|
|
|
//once it's loaded, add the event triggers
|
|
player.load(function(){
|
|
document.querySelector('#loading').remove();
|
|
});
|
|
|
|
var button = document.querySelector('button');
|
|
|
|
button.onmousedown = function(){
|
|
player.loop(0, .1, .11);
|
|
};
|
|
|
|
button.onmouseup = function(){
|
|
player.stop();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |