Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
  var context;
  var request; 
  var source;
  try { 
    context = new (window.AudioContext || window.webkitAudioContext)();
    request = new XMLHttpRequest(); 
    request.open("GET","http://jplayer.org/audio/mp3/RioMez-01-Sleep_together.mp3",true); 
    request.responseType = "arraybuffer"; 
    request.onload = function() { 
      context.decodeAudioData(request.response, function(buffer) { 
        source = context.createBufferSource();  
        source.buffer = buffer; 
        source.connect(context.destination); 
        // auto play
        source.start(0); // start was previously noteOn
      }); 
    }; 
    request.send(); 
  } catch(e) { 
    alert('web audio api not supported'); 
  } 
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers