forked from MTG/essentia.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include patches to freesound and audio-encoder dependencies
- Loading branch information
1 parent
584b134
commit 1b8c9e7
Showing
3 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |