1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 12:36:01 +00:00
This commit is contained in:
MatteZ02
2019-05-30 12:06:47 +03:00
parent cbdffcf19c
commit 5eb0264906
2502 changed files with 360854 additions and 0 deletions

3
node_modules/opusscript/.gitmodules generated vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "opus-native"]
path = opus-native
url = https://github.com/xiph/opus.git

20
node_modules/opusscript/LICENSE generated vendored Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2016-2017 abalabahaha
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

39
node_modules/opusscript/README.md generated vendored Normal file
View File

@ -0,0 +1,39 @@
opusscript
==========
### JS bindings for libopus 1.2.1, ported with emscripten
```js
var opusscript = require("opusscript");
// 48kHz sampling rate, 20ms frame duration, stereo audio (2 channels)
var samplingRate = 48000;
var frameDuration = 20;
var channels = 2;
// Optimize encoding for audio. Available applications are VOIP, AUDIO, and RESTRICTED_LOWDELAY
var encoder = new opusscript(samplingRate, channels, opusscript.Application.AUDIO);
var frameSize = samplingRate * frameDuration / 1000;
// Get PCM data from somewhere and encode it into opus
var pcmData = new Buffer(pcmSource);
var encodedPacket = encoder.encode(pcmData, frameSize);
// Decode the opus packet back into PCM
var decodedPacket = encoder.decode(encodedPacket);
// Delete the encoder when finished with it (Emscripten does not automatically call C++ object destructors)
encoder.delete();
```
#### TypeScript
Since this module wasn't written for TypeScript, you need to use `import = require` syntax.
```ts
// Import using:
import OpusScript = require('opusscript');
// and NOT:
import OpusScript from 'opusscript';
```

44
node_modules/opusscript/build/COPYING.libopus generated vendored Normal file
View File

@ -0,0 +1,44 @@
Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
Jean-Marc Valin, Timothy B. Terriberry,
CSIRO, Gregory Maxwell, Mark Borgerding,
Erik de Castro Lopo
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Opus is subject to the royalty-free patent licenses which are
specified at:
Xiph.Org Foundation:
https://datatracker.ietf.org/ipr/1524/
Microsoft Corporation:
https://datatracker.ietf.org/ipr/1914/
Broadcom Corporation:
https://datatracker.ietf.org/ipr/1526/

21
node_modules/opusscript/build/opusscript_native.js generated vendored Normal file

File diff suppressed because one or more lines are too long

79
node_modules/opusscript/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,79 @@
declare module 'opusscript' {
/**
* Opus application type
*/
enum OpusApplication {
/**
* Voice Over IP
*/
VOIP = 2048,
/**
* Audio
*/
AUDIO = 2049,
/**
* Restricted Low-Delay
*/
RESTRICTED_LOWDELAY = 2051
}
enum OpusError {
"OK" = 0,
"Bad argument" = -1,
"Buffer too small" = -2,
"Internal error" = -3,
"Invalid packet" = -4,
"Unimplemented" = -5,
"Invalid state" = -6,
"Memory allocation fail" = -7
}
/**
* Valid audio sampling rates
*/
type VALID_SAMPLING_RATES = 8000 | 12000 | 16000 | 24000 | 48000;
/**
* Maximum bytes in a frame
*/
type MAX_FRAME_SIZE = 2880;
/**
* Maximum bytes in a packet
*/
type MAX_PACKET_SIZE = 3828;
class OpusScript {
/**
* Different Opus application types
*/
static Application: typeof OpusApplication;
/**
* Opus Error codes
*/
static Error: typeof OpusError;
/**
* Array of sampling rates that Opus can use
*/
static VALID_SAMPLING_RATES: [8000, 12000, 16000, 24000, 48000];
/**
* The maximum size (in bytes) to send in a packet
*/
static MAX_PACKET_SIZE: MAX_PACKET_SIZE;
/**
* Create a new Opus en/decoder
*/
constructor(samplingRate: VALID_SAMPLING_RATES, channels?: number, application?: OpusApplication);
/**
* Encode a buffer into Opus
*/
encode(buffer: Buffer, frameSize: number): Buffer;
/**
* Decode an opus buffer
*/
decode(buffer: Buffer): Buffer;
encoderCTL(ctl: number, arg: number): void;
decoderCTL(ctl: number, arg: number): void;
/**
* Delete the opus object
*/
delete(): void;
}
export = OpusScript;
}

99
node_modules/opusscript/index.js generated vendored Normal file
View File

@ -0,0 +1,99 @@
"use strict";
var opusscript_native = require("./build/opusscript_native.js");
var OpusApplication = {
VOIP: 2048,
AUDIO: 2049,
RESTRICTED_LOWDELAY: 2051
};
var OpusError = {
"0": "OK",
"-1": "Bad argument",
"-2": "Buffer too small",
"-3": "Internal error",
"-4": "Invalid packet",
"-5": "Unimplemented",
"-6": "Invalid state",
"-7": "Memory allocation fail"
};
var VALID_SAMPLING_RATES = [8000, 12000, 16000, 24000, 48000];
var MAX_FRAME_SIZE = 48000 * 60 / 1000;
var MAX_PACKET_SIZE = 1276 * 3;
function OpusScript(samplingRate, channels, application) {
if(!~VALID_SAMPLING_RATES.indexOf(samplingRate)) {
throw new RangeError(`${samplingRate} is an invalid sampling rate.`);
}
this.samplingRate = samplingRate;
this.channels = channels || 1;
this.application = application || OpusApplication.AUDIO;
this.handler = new opusscript_native.OpusScriptHandler(this.samplingRate, this.channels, this.application);
this.inPCMLength = MAX_FRAME_SIZE * this.channels * 2;
this.inPCMPointer = opusscript_native._malloc(this.inPCMLength);
this.inPCM = opusscript_native.HEAPU16.subarray(this.inPCMPointer, this.inPCMPointer + this.inPCMLength);
this.inOpusPointer = opusscript_native._malloc(MAX_PACKET_SIZE);
this.inOpus = opusscript_native.HEAPU8.subarray(this.inOpusPointer, this.inOpusPointer + MAX_PACKET_SIZE);
this.outOpusPointer = opusscript_native._malloc(MAX_PACKET_SIZE);
this.outOpus = opusscript_native.HEAPU8.subarray(this.outOpusPointer, this.outOpusPointer + MAX_PACKET_SIZE);
this.outPCMLength = MAX_FRAME_SIZE * this.channels * 2;
this.outPCMPointer = opusscript_native._malloc(this.outPCMLength);
this.outPCM = opusscript_native.HEAPU16.subarray(this.outPCMPointer, this.outPCMPointer + this.outPCMLength);
};
OpusScript.prototype.encode = function encode(buffer, frameSize) {
this.inPCM.set(buffer);
var len = this.handler._encode(this.inPCM.byteOffset, buffer.length, this.outOpusPointer, frameSize);
if(len < 0) {
throw new Error("Encode error: " + OpusError["" + len]);
}
return new Buffer(this.outOpus.subarray(0, len));
};
OpusScript.prototype.decode = function decode(buffer) {
this.inOpus.set(buffer);
var len = this.handler._decode(this.inOpusPointer, buffer.length, this.outPCM.byteOffset);
if(len < 0) {
throw new Error("Decode error: " + OpusError["" + len]);
}
return new Buffer(this.outPCM.subarray(0, len * this.channels * 2));
};
OpusScript.prototype.encoderCTL = function encoderCTL(ctl, arg) {
var len = this.handler._encoder_ctl(ctl, arg);
if(len < 0) {
throw new Error("Encoder CTL error: " + OpusError["" + len]);
}
};
OpusScript.prototype.decoderCTL = function decoderCTL(ctl, arg) {
var len = this.handler._decoder_ctl(ctl, arg);
if(len < 0) {
throw new Error("Decoder CTL error: " + OpusError["" + len]);
}
};
OpusScript.prototype.delete = function del() {
opusscript_native.OpusScriptHandler.destroy_handler(this.handler);
opusscript_native._free(this.inPCMPointer);
opusscript_native._free(this.inOpusPointer);
opusscript_native._free(this.outOpusPointer);
opusscript_native._free(this.outPCMPointer);
};
OpusScript.Application = OpusApplication;
OpusScript.Error = OpusError;
OpusScript.VALID_SAMPLING_RATES = VALID_SAMPLING_RATES;
OpusScript.MAX_PACKET_SIZE = MAX_PACKET_SIZE;
module.exports = OpusScript;

49
node_modules/opusscript/package.json generated vendored Normal file
View File

@ -0,0 +1,49 @@
{
"_from": "opusscript",
"_id": "opusscript@0.0.6",
"_inBundle": false,
"_integrity": "sha512-F7nx1SWZCD5Rq2W+5Fx39HlkRkz/5Zqt0LglEB9uHexk8HjedDEiM+u/Y2rBfDFcS/0uQIWu2lJhw+Gjsta+cA==",
"_location": "/opusscript",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "opusscript",
"name": "opusscript",
"escapedName": "opusscript",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/opusscript/-/opusscript-0.0.6.tgz",
"_shasum": "cf492fc5fb2c819af296ae02eaa3cf210433c9ba",
"_spec": "opusscript",
"_where": "C:\\Users\\matia\\Bot Files",
"author": {
"name": "abalabahaha"
},
"bugs": {
"url": "https://github.com/abalabahaha/opusscript/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "JS bindings for libopus 1.2.1, ported with emscripten",
"homepage": "https://github.com/abalabahaha/opusscript#readme",
"keywords": [
"libopus",
"encoder",
"emscripten"
],
"license": "MIT",
"main": "index.js",
"name": "opusscript",
"repository": {
"type": "git",
"url": "git+https://github.com/abalabahaha/opusscript.git"
},
"version": "0.0.6"
}