Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
naomiaro committed Jul 29, 2021
1 parent 5e09c35 commit 9ee0b4d
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 34 deletions.
14 changes: 7 additions & 7 deletions dist/webaudio-peaks.amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ define("WebaudioPeaks", [], () => { return /******/ (() => { // webpackBootstrap



//http://jsperf.com/typed-array-min-max/2
//plain for loop for finding min/max is way faster than anything else.
/**
* @param {TypedArray} array - Subarray of audio to calculate peaks from.
*/
Expand All @@ -31,7 +29,7 @@ function findMinMax(array) {

return {
min: min,
max: max,
max: max
};
}

Expand All @@ -41,7 +39,7 @@ function findMinMax(array) {
*/
function convert(n, bits) {
var max = Math.pow(2, bits - 1);
var v = n < 0 ? n * max : n * max - 1;
var v = n < 0 ? n * max : n * (max - 1);
return Math.max(-max, Math.min(max - 1, v));
}

Expand Down Expand Up @@ -124,8 +122,10 @@ function defaultNumber(value, defaultNumber) {
/**
* @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.
* @param {Number} samplesPerPixel - Number of audio samples per peak.
* @param {Boolean} isMono - Whether to render the channels to a single array.
* @param {Number} cueIn - index in channel to start peak calculations from.
* @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).
* @param {Number} bits - number of bits for a peak.
*/
module.exports = function (
source,
Expand All @@ -135,8 +135,8 @@ module.exports = function (
cueOut,
bits
) {
samplesPerPixel = defaultNumber(samplesPerPixel, 10000);
bits = defaultNumber(bits, 8);
samplesPerPixel = defaultNumber(samplesPerPixel, 1000);
bits = defaultNumber(bits, 16);

if (isMono === null || isMono === undefined) {
isMono = true;
Expand Down Expand Up @@ -177,7 +177,7 @@ module.exports = function (
return {
length: numPeaks,
data: peaks,
bits: bits,
bits: bits
};
};

Expand Down
2 changes: 1 addition & 1 deletion dist/webaudio-peaks.amd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions dist/webaudio-peaks.commonjs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@



//http://jsperf.com/typed-array-min-max/2
//plain for loop for finding min/max is way faster than anything else.
/**
* @param {TypedArray} array - Subarray of audio to calculate peaks from.
*/
Expand All @@ -31,7 +29,7 @@ function findMinMax(array) {

return {
min: min,
max: max,
max: max
};
}

Expand All @@ -41,7 +39,7 @@ function findMinMax(array) {
*/
function convert(n, bits) {
var max = Math.pow(2, bits - 1);
var v = n < 0 ? n * max : n * max - 1;
var v = n < 0 ? n * max : n * (max - 1);
return Math.max(-max, Math.min(max - 1, v));
}

Expand Down Expand Up @@ -124,8 +122,10 @@ function defaultNumber(value, defaultNumber) {
/**
* @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.
* @param {Number} samplesPerPixel - Number of audio samples per peak.
* @param {Boolean} isMono - Whether to render the channels to a single array.
* @param {Number} cueIn - index in channel to start peak calculations from.
* @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).
* @param {Number} bits - number of bits for a peak.
*/
module.exports = function (
source,
Expand All @@ -135,8 +135,8 @@ module.exports = function (
cueOut,
bits
) {
samplesPerPixel = defaultNumber(samplesPerPixel, 10000);
bits = defaultNumber(bits, 8);
samplesPerPixel = defaultNumber(samplesPerPixel, 1000);
bits = defaultNumber(bits, 16);

if (isMono === null || isMono === undefined) {
isMono = true;
Expand Down Expand Up @@ -177,7 +177,7 @@ module.exports = function (
return {
length: numPeaks,
data: peaks,
bits: bits,
bits: bits
};
};

Expand Down
2 changes: 1 addition & 1 deletion dist/webaudio-peaks.commonjs2.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions dist/webaudio-peaks.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ return /******/ (() => { // webpackBootstrap



//http://jsperf.com/typed-array-min-max/2
//plain for loop for finding min/max is way faster than anything else.
/**
* @param {TypedArray} array - Subarray of audio to calculate peaks from.
*/
Expand All @@ -41,7 +39,7 @@ function findMinMax(array) {

return {
min: min,
max: max,
max: max
};
}

Expand All @@ -51,7 +49,7 @@ function findMinMax(array) {
*/
function convert(n, bits) {
var max = Math.pow(2, bits - 1);
var v = n < 0 ? n * max : n * max - 1;
var v = n < 0 ? n * max : n * (max - 1);
return Math.max(-max, Math.min(max - 1, v));
}

Expand Down Expand Up @@ -134,8 +132,10 @@ function defaultNumber(value, defaultNumber) {
/**
* @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.
* @param {Number} samplesPerPixel - Number of audio samples per peak.
* @param {Boolean} isMono - Whether to render the channels to a single array.
* @param {Number} cueIn - index in channel to start peak calculations from.
* @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).
* @param {Number} bits - number of bits for a peak.
*/
module.exports = function (
source,
Expand All @@ -145,8 +145,8 @@ module.exports = function (
cueOut,
bits
) {
samplesPerPixel = defaultNumber(samplesPerPixel, 10000);
bits = defaultNumber(bits, 8);
samplesPerPixel = defaultNumber(samplesPerPixel, 1000);
bits = defaultNumber(bits, 16);

if (isMono === null || isMono === undefined) {
isMono = true;
Expand Down Expand Up @@ -187,7 +187,7 @@ module.exports = function (
return {
length: numPeaks,
data: peaks,
bits: bits,
bits: bits
};
};

Expand Down
2 changes: 1 addition & 1 deletion dist/webaudio-peaks.umd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions dist/webaudio-peaks.var.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ var WebaudioPeaks;



//http://jsperf.com/typed-array-min-max/2
//plain for loop for finding min/max is way faster than anything else.
/**
* @param {TypedArray} array - Subarray of audio to calculate peaks from.
*/
Expand All @@ -32,7 +30,7 @@ function findMinMax(array) {

return {
min: min,
max: max,
max: max
};
}

Expand All @@ -42,7 +40,7 @@ function findMinMax(array) {
*/
function convert(n, bits) {
var max = Math.pow(2, bits - 1);
var v = n < 0 ? n * max : n * max - 1;
var v = n < 0 ? n * max : n * (max - 1);
return Math.max(-max, Math.min(max - 1, v));
}

Expand Down Expand Up @@ -125,8 +123,10 @@ function defaultNumber(value, defaultNumber) {
/**
* @param {AudioBuffer,TypedArray} source - Source of audio samples for peak calculations.
* @param {Number} samplesPerPixel - Number of audio samples per peak.
* @param {Boolean} isMono - Whether to render the channels to a single array.
* @param {Number} cueIn - index in channel to start peak calculations from.
* @param {Number} cueOut - index in channel to end peak calculations from (non-inclusive).
* @param {Number} bits - number of bits for a peak.
*/
module.exports = function (
source,
Expand All @@ -136,8 +136,8 @@ module.exports = function (
cueOut,
bits
) {
samplesPerPixel = defaultNumber(samplesPerPixel, 10000);
bits = defaultNumber(bits, 8);
samplesPerPixel = defaultNumber(samplesPerPixel, 1000);
bits = defaultNumber(bits, 16);

if (isMono === null || isMono === undefined) {
isMono = true;
Expand Down Expand Up @@ -178,7 +178,7 @@ module.exports = function (
return {
length: numPeaks,
data: peaks,
bits: bits,
bits: bits
};
};

Expand Down
2 changes: 1 addition & 1 deletion dist/webaudio-peaks.var.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webaudio-peaks",
"version": "0.0.8",
"version": "1.0.0",
"description": "Small library to extract peaks from an array of audio samples or an AudioBuffer from the WebAudio API.",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 9ee0b4d

Please sign in to comment.