diff --git a/examples/demos/onsets/package.json b/examples/demos/onsets/package.json index f6735cf..b887706 100644 --- a/examples/demos/onsets/package.json +++ b/examples/demos/onsets/package.json @@ -7,7 +7,8 @@ "private": true, "scripts": { "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", - "build": "cross-env NODE_ENV=production webpack --progress" + "build": "cross-env NODE_ENV=production webpack --progress", + "postinstall": "npx patch-package" }, "browserslist": [ "> 1%", diff --git a/examples/demos/onsets/patches/audio-encoder+1.0.4.patch b/examples/demos/onsets/patches/audio-encoder+1.0.4.patch new file mode 100644 index 0000000..f1903b6 --- /dev/null +++ b/examples/demos/onsets/patches/audio-encoder+1.0.4.patch @@ -0,0 +1,20 @@ +diff --git a/node_modules/audio-encoder/src/encodeWav.js b/node_modules/audio-encoder/src/encodeWav.js +index 51a531c..3b96798 100644 +--- a/node_modules/audio-encoder/src/encodeWav.js ++++ b/node_modules/audio-encoder/src/encodeWav.js +@@ -82,9 +82,12 @@ function encodeWav(audioBuffer, cb) { + + var blob = new Blob([uint8], { type: 'audio/x-wav' }) + +- setTimeout(function () { +- return cb(blob); +- }, 30); ++ // return new Promise((resolve, _) => { ++ // setTimeout(function () { ++ // resolve(blob); ++ // }, 30); ++ // }); ++ return blob; + } + + module.exports = encodeWav; diff --git a/examples/demos/onsets/patches/freesound+0.0.4.patch b/examples/demos/onsets/patches/freesound+0.0.4.patch new file mode 100644 index 0000000..8bcc225 --- /dev/null +++ b/examples/demos/onsets/patches/freesound+0.0.4.patch @@ -0,0 +1,69 @@ +diff --git a/node_modules/freesound/freesound.js b/node_modules/freesound/freesound.js +index 879d67a..25a1ca1 100644 +--- a/node_modules/freesound/freesound.js ++++ b/node_modules/freesound/freesound.js +@@ -57,46 +57,24 @@ + uri = uri +"?"+ paramStr; + } + +- if (typeof module !== 'undefined'){ // node.js +- var http = require("http"); +- var options = { +- host: host, +- path: uri.substring(uri.indexOf("/",8),uri.length), // first '/' after 'http://' +- port: '80', +- method: method, +- headers: {'Authorization': authHeader} +- }; +- var req = http.request(options,function(res){ +- res.setEncoding('utf8'); +- res.on('data', function (data){ +- if([200,201,202].indexOf(res.statusCode)>=0) +- success(wrapper?wrapper(data):data); +- else +- error(data); +- }); +- }); +- req.on('error', error).end(); +- } +- else{ // browser +- var xhr; +- try {xhr = new XMLHttpRequest();} +- catch (e) {xhr = new ActiveXObject('Microsoft.XMLHTTP');} +- +- xhr.onreadystatechange = function(){ +- if (xhr.readyState === 4 && [200,201,202].indexOf(xhr.status)>=0){ +- var data = eval("(" + xhr.responseText + ")"); +- if(success) success(wrapper?wrapper(data):data); +- } +- else if (xhr.readyState === 4 && xhr.status !== 200){ +- if(error) error(xhr.statusText); +- } +- }; +- xhr.open(method, uri); +- xhr.setRequestHeader('Authorization',authHeader); +- if(content_type!==undefined) +- xhr.setRequestHeader('Content-Type',content_type); +- xhr.send(data); +- } ++ var xhr; ++ try {xhr = new XMLHttpRequest();} ++ catch (e) {xhr = new ActiveXObject('Microsoft.XMLHTTP');} ++ ++ xhr.onreadystatechange = function(){ ++ if (xhr.readyState === 4 && [200,201,202].indexOf(xhr.status)>=0){ ++ var data = eval("(" + xhr.responseText + ")"); ++ if(success) success(wrapper?wrapper(data):data); ++ } ++ else if (xhr.readyState === 4 && xhr.status !== 200){ ++ if(error) error(xhr.statusText); ++ } ++ }; ++ xhr.open(method, uri); ++ xhr.setRequestHeader('Authorization',authHeader); ++ if(content_type!==undefined) ++ xhr.setRequestHeader('Content-Type',content_type); ++ xhr.send(data); + }; + var checkOauth = function(){ + if(authHeader.indexOf("Bearer")==-1)