Created
March 13, 2018 19:00
-
-
Save reportbase/412e07c2a2109b35e3c4d250ad64457d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dogBarkingBuffer = null; | |
window.AudioContext = window.AudioContext || window.webkitAudioContext; | |
var audio = new AudioContext(); | |
var request = new XMLHttpRequest(); | |
request.open('GET', "icons/a.mp3", true); | |
request.responseType = 'arraybuffer'; | |
request.onload = function() | |
{ | |
audio.decodeAudioData(request.response, function(buffer) | |
{ | |
console.log(buffer); | |
dogBarkingBuffer = buffer; | |
// var source = audio.createBufferSource(); | |
// source.buffer = buffer; | |
// source.connect(audio.destination); | |
// source.start(0); | |
}); | |
} | |
request.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/jieverson/DJi/blob/master/index.js