mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
33 lines
No EOL
655 B
HTML
33 lines
No EOL
655 B
HTML
<html>
|
|
<head>
|
|
<title>Basic Player</title>
|
|
<script type="text/javascript" src="../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> |