JSFiddle - React, Tailwind, and code Playground

by Md. Atiquzzaman Soikat

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/0.9.0/Tone.js"></script>
<button id="togglePlay">Play</button>

JavaScript

var sampleURL = "https://upload.wikimedia.org/wikipedia/en/f/f4/Adele_-_Hello_Clip.ogg";

var player = new Tone.Player(sampleURL).toMaster();

//trigger the start of the sample once its loaded
Tone.Buffer.on("load", function(){
	player.start();
});
console.log(player.state);
setTimeout(function(){
	player.stop();
},3000);