New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

imaadpcm

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imaadpcm - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

4

CHANGELOG.md
# CHANGELOG
## v4.1.0 (2019-09-06)
- No clicks or time changes when compressing/decompressing
- Fix: Range error bug when compressing
## v4.0.1 (2018-07-02)

@@ -4,0 +8,0 @@ - Fix output array size on encode()

16

dist/imaadpcm.cjs.js

@@ -9,3 +9,3 @@ 'use strict';

* Copyright (c) 2016 acida. MIT License.
* Copyright (c) 2018 Rafael da Silva Rocha.
* Copyright (c) 2018-2019 Rafael da Silva Rocha.
*

@@ -96,3 +96,3 @@ * Permission is hereby granted, free of charge, to any person obtaining

/** @type {!Uint8Array} */
let adpcmSamples = new Uint8Array((samples.length / 2) + 512);
let adpcmSamples = new Uint8Array((samples.length));
/** @type {!Array<number>} */

@@ -110,3 +110,3 @@ let block = [];

}
return adpcmSamples;
return adpcmSamples.slice(0, (samples.length/2) + 512);
}

@@ -129,4 +129,5 @@

if (i % blockAlign == 0 && i != 0) {
samples.set(decodeBlock(block), fileIndex);
fileIndex += blockAlign * 2;
let decoded = decodeBlock(block);
samples.set(decoded, fileIndex);
fileIndex += decoded.length;
block = [];

@@ -154,5 +155,2 @@ }

}
while (adpcmSamples.length < 256) {
adpcmSamples.push(0);
}
return adpcmSamples;

@@ -173,3 +171,3 @@ }

decoderPredicted_,
sign_((block[3] << 8) | block[2])
decoderPredicted_
];

@@ -176,0 +174,0 @@ for (let i=4; i<block.length; i++) {

@@ -5,3 +5,3 @@ /*

* Copyright (c) 2016 acida. MIT License.
* Copyright (c) 2018 Rafael da Silva Rocha.
* Copyright (c) 2018-2019 Rafael da Silva Rocha.
*

@@ -92,3 +92,3 @@ * Permission is hereby granted, free of charge, to any person obtaining

/** @type {!Uint8Array} */
let adpcmSamples = new Uint8Array((samples.length / 2) + 512);
let adpcmSamples = new Uint8Array((samples.length));
/** @type {!Array<number>} */

@@ -106,3 +106,3 @@ let block = [];

}
return adpcmSamples;
return adpcmSamples.slice(0, (samples.length/2) + 512);
}

@@ -125,4 +125,5 @@

if (i % blockAlign == 0 && i != 0) {
samples.set(decodeBlock(block), fileIndex);
fileIndex += blockAlign * 2;
let decoded = decodeBlock(block);
samples.set(decoded, fileIndex);
fileIndex += decoded.length;
block = [];

@@ -150,5 +151,2 @@ }

}
while (adpcmSamples.length < 256) {
adpcmSamples.push(0);
}
return adpcmSamples;

@@ -169,3 +167,3 @@ }

decoderPredicted_,
sign_((block[3] << 8) | block[2])
decoderPredicted_
];

@@ -172,0 +170,0 @@ for (let i=4; i<block.length; i++) {

@@ -6,5 +6,5 @@ /*

*/
window.imaadpcm=function(m){function q(b){var a=b[0];n(a);var c=[];c.push(a&255);c.push(a>>8&255);c.push(k);c.push(0);for(a=3;a<b.length;a+=2){var d=n(b[a]),f=n(b[a+1]);c.push(f<<4|d)}for(;256>c.length;)c.push(0);return c}function r(b){e=t(b[1]<<8|b[0]);g=b[2];l=p[g];for(var a=[e,t(b[3]<<8|b[2])],c=4;c<b.length;c++){var d=b[c],f=d>>4;a.push(u(f<<4^d));a.push(u(f))}return a}function t(b){return 32768<b?b-65536:b}function n(b){var a=b-h;0<=a?b=0:(b=8,a=-a);var c=p[k],d=c>>3;a>c&&(b|=4,a-=c,d+=c);c>>=
1;a>c&&(b|=2,a-=c,d+=c);c>>=1;a>c&&(b|=1,d+=c);a=b;h=a&8?h-d:h+d;-32768>h?h=-32768:32767<h&&(h=32767);k+=v[a&7];0>k?k=0:88<k&&(k=88);return b}function u(b){var a=0;b&4&&(a+=l);b&2&&(a+=l>>1);b&1&&(a+=l>>2);a+=l>>3;b&8&&(a=-a);e+=a;32767<e?e=32767:-32767>e&&(e=-32767);g+=v[b];0>g?g=0:88<g&&(g=88);l=p[g];return e}var v=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],p=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,
408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],h=0,k=0,e=0,g=0,l=7;m.encode=function(b){for(var a=new Uint8Array(b.length/2+512),c=[],d=0,f=0;f<b.length;f++)0==f%505&&0!=f&&(a.set(q(c),d),d+=256,c=[]),c.push(b[f]);return a};m.decode=function(b,a){a=void 0===a?256:a;for(var c=new Int16Array(2*b.length),d=[],f=
0,e=0;e<b.length;e++)0==e%a&&0!=e&&(c.set(r(d),f),f+=2*a,d=[]),d.push(b[e]);return c};m.encodeBlock=q;m.decodeBlock=r;return m}({});
window.imaadpcm=function(m){function q(b){var a=b[0];n(a);var c=[];c.push(a&255);c.push(a>>8&255);c.push(k);c.push(0);for(a=3;a<b.length;a+=2){var d=n(b[a]),f=n(b[a+1]);c.push(f<<4|d)}return c}function r(b){var a=b[1]<<8|b[0];e=32768<a?a-65536:a;g=b[2];l=p[g];a=[e,e];for(var c=4;c<b.length;c++){var d=b[c],f=d>>4;a.push(t(f<<4^d));a.push(t(f))}return a}function n(b){var a=b-h;0<=a?b=0:(b=8,a=-a);var c=p[k],d=c>>3;a>c&&(b|=4,a-=c,d+=c);c>>=1;a>c&&(b|=2,a-=c,d+=c);c>>=1;a>c&&(b|=1,d+=c);a=b;h=a&8?h-
d:h+d;-32768>h?h=-32768:32767<h&&(h=32767);k+=u[a&7];0>k?k=0:88<k&&(k=88);return b}function t(b){var a=0;b&4&&(a+=l);b&2&&(a+=l>>1);b&1&&(a+=l>>2);a+=l>>3;b&8&&(a=-a);e+=a;32767<e?e=32767:-32767>e&&(e=-32767);g+=u[b];0>g?g=0:88<g&&(g=88);l=p[g];return e}var u=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],p=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,
1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],h=0,k=0,e=0,g=0,l=7;m.encode=function(b){for(var a=new Uint8Array(b.length),c=[],d=0,f=0;f<b.length;f++)0==f%505&&0!=f&&(a.set(q(c),d),d+=256,c=[]),c.push(b[f]);return a.slice(0,b.length/2+512)};m.decode=function(b,a){a=void 0===a?256:a;for(var c=new Int16Array(2*b.length),d=[],f=0,e=0;e<b.length;e++)0==e%a&&0!=e&&(d=r(d),
c.set(d,f),f+=d.length,d=[]),d.push(b[e]);return c};m.encodeBlock=q;m.decodeBlock=r;return m}({});

@@ -11,3 +11,3 @@ (function (global, factory) {

* Copyright (c) 2016 acida. MIT License.
* Copyright (c) 2018 Rafael da Silva Rocha.
* Copyright (c) 2018-2019 Rafael da Silva Rocha.
*

@@ -98,3 +98,3 @@ * Permission is hereby granted, free of charge, to any person obtaining

/** @type {!Uint8Array} */
let adpcmSamples = new Uint8Array((samples.length / 2) + 512);
let adpcmSamples = new Uint8Array((samples.length));
/** @type {!Array<number>} */

@@ -112,3 +112,3 @@ let block = [];

}
return adpcmSamples;
return adpcmSamples.slice(0, (samples.length/2) + 512);
}

@@ -131,4 +131,5 @@

if (i % blockAlign == 0 && i != 0) {
samples.set(decodeBlock(block), fileIndex);
fileIndex += blockAlign * 2;
let decoded = decodeBlock(block);
samples.set(decoded, fileIndex);
fileIndex += decoded.length;
block = [];

@@ -156,5 +157,2 @@ }

}
while (adpcmSamples.length < 256) {
adpcmSamples.push(0);
}
return adpcmSamples;

@@ -175,3 +173,3 @@ }

decoderPredicted_,
sign_((block[3] << 8) | block[2])
decoderPredicted_
];

@@ -178,0 +176,0 @@ for (let i=4; i<block.length; i++) {

@@ -5,3 +5,3 @@ /*

* Copyright (c) 2016 acida. MIT License.
* Copyright (c) 2018 Rafael da Silva Rocha.
* Copyright (c) 2018-2019 Rafael da Silva Rocha.
*

@@ -97,3 +97,3 @@ * Permission is hereby granted, free of charge, to any person obtaining

/** @type {!Uint8Array} */
let adpcmSamples = new Uint8Array((samples.length / 2) + 512);
let adpcmSamples = new Uint8Array((samples.length));
/** @type {!Array<number>} */

@@ -111,3 +111,3 @@ let block = [];

}
return adpcmSamples;
return adpcmSamples.slice(0, (samples.length/2) + 512);
}

@@ -130,4 +130,5 @@

if (i % blockAlign == 0 && i != 0) {
samples.set(decodeBlock(block), fileIndex);
fileIndex += blockAlign * 2;
let decoded = decodeBlock(block);
samples.set(decoded, fileIndex);
fileIndex += decoded.length;
block = [];

@@ -155,5 +156,2 @@ }

}
while (adpcmSamples.length < 256) {
adpcmSamples.push(0);
}
return adpcmSamples;

@@ -174,3 +172,3 @@ }

decoderPredicted_,
sign_((block[3] << 8) | block[2])
decoderPredicted_
];

@@ -177,0 +175,0 @@ for (let i=4; i<block.length; i++) {

{
"name": "imaadpcm",
"version": "4.0.1",
"version": "4.1.0",
"description": "IMA ADPCM codec in JavaScript.",

@@ -52,7 +52,7 @@ "homepage": "https://github.com/rochars/imaadpcm",

"devDependencies": {
"browser-env": "^3.2.5",
"browser-env": "^3.2.6",
"chai": "^4.1.2",
"codecov": "^3.0.2",
"docdash": "^0.4.0",
"esm": "^3.0.51",
"esm": "^3.2.25",
"google-closure-compiler-js": "^20180610.0.0",

@@ -59,0 +59,0 @@ "jsdoc": "^3.5.5",

# imaadpcm
Copyright (c) 2018 Rafael da Silva Rocha.
Copyright (c) 2018-2019 Rafael da Silva Rocha.
https://github.com/rochars/imaadpcm

@@ -15,48 +15,2 @@

## Use
### ES6
import imaadpcm from **imaadpcm.js**:
```javascript
import * as imaadpcm from 'imaadpcm.js';
let adpcmSamples = imaadpcm.encode(pcmSamples);
```
### Node
Require imaadpcm from "imaadpcm":
```javascript
const imaadpcm = require("imaadpcm");
let adpcmSamples = imaadpcm.encode(pcmSamples);
```
### Browser
Use the compiled file in the */dist* folder:
```html
<script src="imaadpcm.min.js"></script>
<script>
var adpcmSamples = imaadpcm.encode(pcmSamples);
pcmSamples = imaadpcm.decode(adpcmSamples);
var adpcmBlock = imaadpcm.encodeBlock(pcmBlock);
pcmBlock = imaadpcm.decodeBlock(adpcmBlock);
</script>
```
Or get it from the [jsDelivr](https://www.jsdelivr.com) CDN:
```html
<script src="https://cdn.jsdelivr.net/npm/imaadpcm"></script>
```
Or get it from [unpkg](https://www.unpkg.com):
```html
<script src="https://unpkg.com/imaadpcm"></script>
```
Or as a ES6 module in modern browsers from [jspm](https://jspm.io):
```html
<script type="module">
import * as imaadpcm from 'https://dev.jspm.io/imaadpcm';
// ...
</script>
```
## Examples

@@ -138,3 +92,3 @@

Copyright (c) 2016 acida. MIT License.
Copyright (c) 2018 Rafael da Silva Rocha.
Copyright (c) 2018-2019 Rafael da Silva Rocha.

@@ -141,0 +95,0 @@ Permission is hereby granted, free of charge, to any person obtaining

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc