Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit lib files as some were deleted from npm
- Loading branch information
1 parent
e3e70a1
commit f9c6097
Showing
2,325 changed files
with
391,868 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,5 @@ | |
.vscode | ||
node_modules | ||
app/.build | ||
app/lib | ||
.DS_Store | ||
npm-debug.log | ||
dist | ||
dist.zip | ||
npm-debug.log |
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,32 @@ | ||
{ | ||
"name": "RecorderJS", | ||
"homepage": "https://github.com/lukephills/Recorderjs", | ||
"authors": [ | ||
"Luke Phillips <luke@femurdesign.com>" | ||
], | ||
"description": "Recording from web audio API and exporting to wav", | ||
"main": "recorder.js", | ||
"keywords": [ | ||
"Audio", | ||
"Wav", | ||
"Sound", | ||
"Record", | ||
"Recording" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"_release": "1edf02ae47", | ||
"_resolution": { | ||
"type": "branch", | ||
"branch": "master", | ||
"commit": "1edf02ae47cd93d060adda2176f99b5afc39cdc8" | ||
}, | ||
"_source": "git://github.com/lukephills/Recorderjs.git", | ||
"_target": "master", | ||
"_originalSource": "lukephills/Recorderjs" | ||
} |
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 @@ | ||
.idea |
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,23 @@ | ||
{ | ||
"name": "RecorderJS", | ||
"homepage": "https://github.com/lukephills/Recorderjs", | ||
"authors": [ | ||
"Luke Phillips <luke@femurdesign.com>" | ||
], | ||
"description": "Recording from web audio API and exporting to wav", | ||
"main": "recorder.js", | ||
"keywords": [ | ||
"Audio", | ||
"Wav", | ||
"Sound", | ||
"Record", | ||
"Recording" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
] | ||
} |
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,14 @@ | ||
declare var RecorderJS: { | ||
new(AudioSource: any, config?: any): RecorderJS; | ||
}; | ||
|
||
interface RecorderJS { | ||
record(): void; | ||
stop(): void; | ||
clear(): void; | ||
exportWAV(callback?: any, type?: string); | ||
exportMonoWAV(callback?: any, type?: string); | ||
setupDownload(blob, filename?): void; | ||
getBuffer(callback?: any) | ||
configure(any): void; | ||
} |
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,106 @@ | ||
(function(window){ | ||
|
||
var WORKER_PATH = 'recorderWorker.js'; | ||
|
||
var RecorderJS = function(source, cfg){ | ||
var config = cfg || {}; | ||
var bufferLen = config.bufferLen || 4096; | ||
this.context = source.context; | ||
if(!this.context.createScriptProcessor){ | ||
this.node = this.context.createJavaScriptNode(bufferLen, 2, 2); | ||
} else { | ||
this.node = this.context.createScriptProcessor(bufferLen, 2, 2); | ||
} | ||
|
||
var worker = new Worker(config.workerPath || WORKER_PATH); | ||
worker.postMessage({ | ||
command: 'init', | ||
config: { | ||
sampleRate: this.context.sampleRate | ||
} | ||
}); | ||
var recording = false, | ||
currCallback; | ||
|
||
this.node.onaudioprocess = function(e){ | ||
if (!recording) return; | ||
worker.postMessage({ | ||
command: 'record', | ||
buffer: [ | ||
e.inputBuffer.getChannelData(0), | ||
e.inputBuffer.getChannelData(1) | ||
] | ||
}); | ||
} | ||
|
||
this.configure = function(cfg){ | ||
for (var prop in cfg){ | ||
if (cfg.hasOwnProperty(prop)){ | ||
config[prop] = cfg[prop]; | ||
} | ||
} | ||
} | ||
|
||
this.record = function(){ | ||
recording = true; | ||
} | ||
|
||
this.stop = function(){ | ||
recording = false; | ||
} | ||
|
||
this.clear = function(){ | ||
worker.postMessage({ command: 'clear' }); | ||
} | ||
|
||
this.getBuffers = function(cb) { | ||
currCallback = cb || config.callback; | ||
worker.postMessage({ command: 'getBuffers' }) | ||
} | ||
|
||
this.exportWAV = function(cb, type){ | ||
currCallback = cb || config.callback; | ||
type = type || config.type || 'audio/wav'; | ||
if (!currCallback) throw new Error('Callback not set'); | ||
worker.postMessage({ | ||
command: 'exportWAV', | ||
type: type | ||
}); | ||
} | ||
|
||
this.exportMonoWAV = function(cb, type){ | ||
currCallback = cb || config.callback; | ||
type = type || config.type || 'audio/wav'; | ||
if (!currCallback) throw new Error('Callback not set'); | ||
worker.postMessage({ | ||
command: 'exportMonoWAV', | ||
type: type | ||
}); | ||
} | ||
|
||
this.setupDownload = function(blob, filename){ | ||
var url = (window.URL || window.webkitURL).createObjectURL(blob); | ||
var link = window.document.createElement('a'); | ||
link.href = url; | ||
link.download = filename || 'output.wav'; | ||
document.body.appendChild(link); | ||
link.innerHTML = 'DOWNLOAD' | ||
|
||
// CHROME DOESNT ALLOW THIS ANY MORE | ||
var click = document.createEvent("Event"); | ||
click.initEvent("click", true, true); | ||
link.dispatchEvent(click); | ||
} | ||
|
||
worker.onmessage = function(e){ | ||
var blob = e.data; | ||
currCallback(blob); | ||
} | ||
|
||
source.connect(this.node); | ||
this.node.connect(this.context.destination); // if the script node is not connected to an output the "onaudioprocess" event is not triggered in chrome. | ||
}; | ||
|
||
window.RecorderJS = RecorderJS; | ||
|
||
})(window); |
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,142 @@ | ||
var recLength = 0, | ||
recBuffersL = [], | ||
recBuffersR = [], | ||
sampleRate; | ||
|
||
this.onmessage = function(e){ | ||
switch(e.data.command){ | ||
case 'init': | ||
init(e.data.config); | ||
break; | ||
case 'record': | ||
record(e.data.buffer); | ||
break; | ||
case 'exportWAV': | ||
exportWAV(e.data.type); | ||
break; | ||
case 'exportMonoWAV': | ||
exportMonoWAV(e.data.type); | ||
break; | ||
case 'getBuffers': | ||
getBuffers(); | ||
break; | ||
case 'clear': | ||
clear(); | ||
break; | ||
} | ||
}; | ||
|
||
function init(config){ | ||
sampleRate = config.sampleRate; | ||
} | ||
|
||
function record(inputBuffer){ | ||
recBuffersL.push(inputBuffer[0]); | ||
recBuffersR.push(inputBuffer[1]); | ||
recLength += inputBuffer[0].length; | ||
} | ||
|
||
function exportWAV(type){ | ||
var bufferL = mergeBuffers(recBuffersL, recLength); | ||
var bufferR = mergeBuffers(recBuffersR, recLength); | ||
var interleaved = interleave(bufferL, bufferR); | ||
var dataview = encodeWAV(interleaved); | ||
var audioBlob = new Blob([dataview], { type: type }); | ||
|
||
this.postMessage(audioBlob); | ||
} | ||
|
||
function exportMonoWAV(type){ | ||
var bufferL = mergeBuffers(recBuffersL, recLength); | ||
var dataview = encodeWAV(bufferL, true); | ||
var audioBlob = new Blob([dataview], { type: type }); | ||
|
||
this.postMessage(audioBlob); | ||
} | ||
|
||
function getBuffers() { | ||
var buffers = []; | ||
buffers.push( mergeBuffers(recBuffersL, recLength) ); | ||
buffers.push( mergeBuffers(recBuffersR, recLength) ); | ||
this.postMessage(buffers); | ||
} | ||
|
||
function clear(){ | ||
recLength = 0; | ||
recBuffersL = []; | ||
recBuffersR = []; | ||
} | ||
|
||
function mergeBuffers(recBuffers, recLength){ | ||
var result = new Float32Array(recLength); | ||
var offset = 0; | ||
for (var i = 0; i < recBuffers.length; i++){ | ||
result.set(recBuffers[i], offset); | ||
offset += recBuffers[i].length; | ||
} | ||
return result; | ||
} | ||
|
||
function interleave(inputL, inputR){ | ||
var length = inputL.length + inputR.length; | ||
var result = new Float32Array(length); | ||
|
||
var index = 0, | ||
inputIndex = 0; | ||
|
||
while (index < length){ | ||
result[index++] = inputL[inputIndex]; | ||
result[index++] = inputR[inputIndex]; | ||
inputIndex++; | ||
} | ||
return result; | ||
} | ||
|
||
function floatTo16BitPCM(output, offset, input){ | ||
for (var i = 0; i < input.length; i++, offset+=2){ | ||
var s = Math.max(-1, Math.min(1, input[i])); | ||
output.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true); | ||
} | ||
} | ||
|
||
function writeString(view, offset, string){ | ||
for (var i = 0; i < string.length; i++){ | ||
view.setUint8(offset + i, string.charCodeAt(i)); | ||
} | ||
} | ||
|
||
function encodeWAV(samples, mono){ | ||
var buffer = new ArrayBuffer(44 + samples.length * 2); | ||
var view = new DataView(buffer); | ||
|
||
/* RIFF identifier */ | ||
writeString(view, 0, 'RIFF'); | ||
/* file length */ | ||
view.setUint32(4, 32 + samples.length * 2, true); | ||
/* RIFF type */ | ||
writeString(view, 8, 'WAVE'); | ||
/* format chunk identifier */ | ||
writeString(view, 12, 'fmt '); | ||
/* format chunk length */ | ||
view.setUint32(16, 16, true); | ||
/* sample format (raw) */ | ||
view.setUint16(20, 1, true); | ||
/* channel count */ | ||
view.setUint16(22, mono?1:2, true); | ||
/* sample rate */ | ||
view.setUint32(24, sampleRate, true); | ||
/* byte rate (sample rate * block align) */ | ||
view.setUint32(28, sampleRate * 4, true); | ||
/* block align (channel count * bytes per sample) */ | ||
view.setUint16(32, 4, true); | ||
/* bits per sample */ | ||
view.setUint16(34, 16, true); | ||
/* data chunk identifier */ | ||
writeString(view, 36, 'data'); | ||
/* data chunk length */ | ||
view.setUint32(40, samples.length * 2, true); | ||
|
||
floatTo16BitPCM(view, 44, samples); | ||
|
||
return view; | ||
} |
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,16 @@ | ||
{ | ||
"name": "bower-webfontloader", | ||
"version": "1.5.16", | ||
"main": "webfont.js", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/mdarse/bower-webfontloader", | ||
"_release": "1.5.16", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "v1.5.16", | ||
"commit": "006087cf80f07706e493644107be22df7cb570ad" | ||
}, | ||
"_source": "git://github.com/mdarse/bower-webfontloader.git", | ||
"_target": "~1.5.16", | ||
"_originalSource": "bower-webfontloader" | ||
} |
Oops, something went wrong.