@rocket.chat/mp3-encoder 0.31.14-dev.1 → 0.31.14-dev.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1358,6 +1358,24 @@ function III_psy_ratio() {
1358
1358
 
1359
1359
  var III_psy_ratio_1 = III_psy_ratio;
1360
1360
 
1361
+ //package mp3;
1362
+
1363
+ /* MPEG modes */
1364
+ function MPEGMode$2(ordinal) {
1365
+ var _ordinal = ordinal;
1366
+ this.ordinal = function () {
1367
+ return _ordinal;
1368
+ };
1369
+ }
1370
+
1371
+ MPEGMode$2.STEREO = new MPEGMode$2(0);
1372
+ MPEGMode$2.JOINT_STEREO = new MPEGMode$2(1);
1373
+ MPEGMode$2.DUAL_CHANNEL = new MPEGMode$2(2);
1374
+ MPEGMode$2.MONO = new MPEGMode$2(3);
1375
+ MPEGMode$2.NOT_SET = new MPEGMode$2(4);
1376
+
1377
+ var MPEGMode_1 = MPEGMode$2;
1378
+
1361
1379
  var common$l = common$o;
1362
1380
  var System$7 = common$l.System;
1363
1381
  var VbrMode$6 = common$l.VbrMode;
@@ -1462,6 +1480,7 @@ Encoder$d.fircoef = [-0.0207887 * 5, -0.0378413 * 5,
1462
1480
  function Encoder$d() {
1463
1481
  var NewMDCT = NewMDCT_1;
1464
1482
  var III_psy_ratio = III_psy_ratio_1;
1483
+ var MPEGMode = MPEGMode_1;
1465
1484
 
1466
1485
  var FFTOFFSET = Encoder$d.FFTOFFSET;
1467
1486
  var MPG_MD_MS_LR = Encoder$d.MPG_MD_MS_LR;
@@ -2402,7 +2421,7 @@ var FFT = FFT_1;
2402
2421
  var Encoder$b = Encoder_1;
2403
2422
 
2404
2423
  function PsyModel$1() {
2405
-
2424
+ var MPEGMode = MPEGMode_1;
2406
2425
  var fft = new FFT();
2407
2426
 
2408
2427
  var LOG10 = 2.30258509299404568402;
@@ -5101,24 +5120,6 @@ function PsyModel$1() {
5101
5120
 
5102
5121
  var PsyModel_1 = PsyModel$1;
5103
5122
 
5104
- //package mp3;
5105
-
5106
- /* MPEG modes */
5107
- function MPEGMode$2(ordinal) {
5108
- var _ordinal = ordinal;
5109
- this.ordinal = function () {
5110
- return _ordinal;
5111
- };
5112
- }
5113
-
5114
- MPEGMode$2.STEREO = new MPEGMode$2(0);
5115
- MPEGMode$2.JOINT_STEREO = new MPEGMode$2(1);
5116
- MPEGMode$2.DUAL_CHANNEL = new MPEGMode$2(2);
5117
- MPEGMode$2.MONO = new MPEGMode$2(3);
5118
- MPEGMode$2.NOT_SET = new MPEGMode$2(4);
5119
-
5120
- var MPEGMode_1 = MPEGMode$2;
5121
-
5122
5123
  var MPEGMode$1 = MPEGMode_1;
5123
5124
 
5124
5125
  function LameGlobalFlags$1() {
@@ -6172,26 +6173,26 @@ var Arrays$4 = common$c.Arrays;
6172
6173
  /**
6173
6174
  * Table entries per dB
6174
6175
  */
6175
- GainAnalysis$2.STEPS_per_dB = 100.;
6176
+ GainAnalysis$3.STEPS_per_dB = 100.;
6176
6177
  /**
6177
6178
  * Table entries for 0...MAX_dB (normal max. values are 70...80 dB)
6178
6179
  */
6179
- GainAnalysis$2.MAX_dB = 120.;
6180
- GainAnalysis$2.GAIN_NOT_ENOUGH_SAMPLES = -24601;
6181
- GainAnalysis$2.GAIN_ANALYSIS_ERROR = 0;
6182
- GainAnalysis$2.GAIN_ANALYSIS_OK = 1;
6183
- GainAnalysis$2.INIT_GAIN_ANALYSIS_ERROR = 0;
6184
- GainAnalysis$2.INIT_GAIN_ANALYSIS_OK = 1;
6180
+ GainAnalysis$3.MAX_dB = 120.;
6181
+ GainAnalysis$3.GAIN_NOT_ENOUGH_SAMPLES = -24601;
6182
+ GainAnalysis$3.GAIN_ANALYSIS_ERROR = 0;
6183
+ GainAnalysis$3.GAIN_ANALYSIS_OK = 1;
6184
+ GainAnalysis$3.INIT_GAIN_ANALYSIS_ERROR = 0;
6185
+ GainAnalysis$3.INIT_GAIN_ANALYSIS_OK = 1;
6185
6186
 
6186
- GainAnalysis$2.YULE_ORDER = 10;
6187
- GainAnalysis$2.MAX_ORDER = GainAnalysis$2.YULE_ORDER;
6187
+ GainAnalysis$3.YULE_ORDER = 10;
6188
+ GainAnalysis$3.MAX_ORDER = GainAnalysis$3.YULE_ORDER;
6188
6189
 
6189
- GainAnalysis$2.MAX_SAMP_FREQ = 48000;
6190
- GainAnalysis$2.RMS_WINDOW_TIME_NUMERATOR = 1;
6191
- GainAnalysis$2.RMS_WINDOW_TIME_DENOMINATOR = 20;
6192
- GainAnalysis$2.MAX_SAMPLES_PER_WINDOW = ((GainAnalysis$2.MAX_SAMP_FREQ * GainAnalysis$2.RMS_WINDOW_TIME_NUMERATOR) / GainAnalysis$2.RMS_WINDOW_TIME_DENOMINATOR + 1);
6190
+ GainAnalysis$3.MAX_SAMP_FREQ = 48000;
6191
+ GainAnalysis$3.RMS_WINDOW_TIME_NUMERATOR = 1;
6192
+ GainAnalysis$3.RMS_WINDOW_TIME_DENOMINATOR = 20;
6193
+ GainAnalysis$3.MAX_SAMPLES_PER_WINDOW = ((GainAnalysis$3.MAX_SAMP_FREQ * GainAnalysis$3.RMS_WINDOW_TIME_NUMERATOR) / GainAnalysis$3.RMS_WINDOW_TIME_DENOMINATOR + 1);
6193
6194
 
6194
- function GainAnalysis$2() {
6195
+ function GainAnalysis$3() {
6195
6196
  /**
6196
6197
  * calibration value for 89dB
6197
6198
  */
@@ -6200,11 +6201,11 @@ function GainAnalysis$2() {
6200
6201
  * percentile which is louder than the proposed level
6201
6202
  */
6202
6203
  var RMS_PERCENTILE = 0.95;
6203
- var RMS_WINDOW_TIME_NUMERATOR = GainAnalysis$2.RMS_WINDOW_TIME_NUMERATOR;
6204
+ var RMS_WINDOW_TIME_NUMERATOR = GainAnalysis$3.RMS_WINDOW_TIME_NUMERATOR;
6204
6205
  /**
6205
6206
  * numerator / denominator = time slice size [s]
6206
6207
  */
6207
- var RMS_WINDOW_TIME_DENOMINATOR = GainAnalysis$2.RMS_WINDOW_TIME_DENOMINATOR;
6208
+ var RMS_WINDOW_TIME_DENOMINATOR = GainAnalysis$3.RMS_WINDOW_TIME_DENOMINATOR;
6208
6209
 
6209
6210
 
6210
6211
  var ABYule = [
@@ -6521,7 +6522,7 @@ function GainAnalysis$2() {
6521
6522
  rgData.totsamp += cursamples;
6522
6523
  if (rgData.totsamp == rgData.sampleWindow) {
6523
6524
  /* Get the Root Mean Square (RMS) for this set of samples */
6524
- var val = GainAnalysis$2.STEPS_per_dB
6525
+ var val = GainAnalysis$3.STEPS_per_dB
6525
6526
  * 10.
6526
6527
  * Math.log10((rgData.lsum + rgData.rsum)
6527
6528
  / rgData.totsamp * 0.5 + 1.e-37);
@@ -6584,7 +6585,7 @@ function GainAnalysis$2() {
6584
6585
  }
6585
6586
 
6586
6587
  //return (float) ((float) PINK_REF - (float) i / (float) STEPS_per_dB);
6587
- return (PINK_REF - i / GainAnalysis$2.STEPS_per_dB);
6588
+ return (PINK_REF - i / GainAnalysis$3.STEPS_per_dB);
6588
6589
  }
6589
6590
 
6590
6591
  this.GetTitleGain = function (rgData) {
@@ -6605,38 +6606,38 @@ function GainAnalysis$2() {
6605
6606
 
6606
6607
  }
6607
6608
 
6608
- var GainAnalysis_1 = GainAnalysis$2;
6609
+ var GainAnalysis_1 = GainAnalysis$3;
6609
6610
 
6610
6611
  var common$b = common$o;
6611
6612
  var new_float$5 = common$b.new_float;
6612
6613
  var new_int$5 = common$b.new_int;
6613
6614
 
6614
- var GainAnalysis$1 = GainAnalysis_1;
6615
+ var GainAnalysis$2 = GainAnalysis_1;
6615
6616
 
6616
6617
  function ReplayGain$1() {
6617
- this.linprebuf = new_float$5(GainAnalysis$1.MAX_ORDER * 2);
6618
+ this.linprebuf = new_float$5(GainAnalysis$2.MAX_ORDER * 2);
6618
6619
  /**
6619
6620
  * left input samples, with pre-buffer
6620
6621
  */
6621
6622
  this.linpre = 0;
6622
- this.lstepbuf = new_float$5(GainAnalysis$1.MAX_SAMPLES_PER_WINDOW + GainAnalysis$1.MAX_ORDER);
6623
+ this.lstepbuf = new_float$5(GainAnalysis$2.MAX_SAMPLES_PER_WINDOW + GainAnalysis$2.MAX_ORDER);
6623
6624
  /**
6624
6625
  * left "first step" (i.e. post first filter) samples
6625
6626
  */
6626
6627
  this.lstep = 0;
6627
- this.loutbuf = new_float$5(GainAnalysis$1.MAX_SAMPLES_PER_WINDOW + GainAnalysis$1.MAX_ORDER);
6628
+ this.loutbuf = new_float$5(GainAnalysis$2.MAX_SAMPLES_PER_WINDOW + GainAnalysis$2.MAX_ORDER);
6628
6629
  /**
6629
6630
  * left "out" (i.e. post second filter) samples
6630
6631
  */
6631
6632
  this.lout = 0;
6632
- this.rinprebuf = new_float$5(GainAnalysis$1.MAX_ORDER * 2);
6633
+ this.rinprebuf = new_float$5(GainAnalysis$2.MAX_ORDER * 2);
6633
6634
  /**
6634
6635
  * right input samples ...
6635
6636
  */
6636
6637
  this.rinpre = 0;
6637
- this.rstepbuf = new_float$5(GainAnalysis$1.MAX_SAMPLES_PER_WINDOW + GainAnalysis$1.MAX_ORDER);
6638
+ this.rstepbuf = new_float$5(GainAnalysis$2.MAX_SAMPLES_PER_WINDOW + GainAnalysis$2.MAX_ORDER);
6638
6639
  this.rstep = 0;
6639
- this.routbuf = new_float$5(GainAnalysis$1.MAX_SAMPLES_PER_WINDOW + GainAnalysis$1.MAX_ORDER);
6640
+ this.routbuf = new_float$5(GainAnalysis$2.MAX_SAMPLES_PER_WINDOW + GainAnalysis$2.MAX_ORDER);
6640
6641
  this.rout = 0;
6641
6642
  /**
6642
6643
  * number of samples required to reach number of milliseconds required
@@ -6648,8 +6649,8 @@ function ReplayGain$1() {
6648
6649
  this.rsum = 0.;
6649
6650
  this.freqindex = 0;
6650
6651
  this.first = 0;
6651
- this.A = new_int$5(0 | (GainAnalysis$1.STEPS_per_dB * GainAnalysis$1.MAX_dB));
6652
- this.B = new_int$5(0 | (GainAnalysis$1.STEPS_per_dB * GainAnalysis$1.MAX_dB));
6652
+ this.A = new_int$5(0 | (GainAnalysis$2.STEPS_per_dB * GainAnalysis$2.MAX_dB));
6653
+ this.B = new_int$5(0 | (GainAnalysis$2.STEPS_per_dB * GainAnalysis$2.MAX_dB));
6653
6654
 
6654
6655
  }
6655
6656
 
@@ -7302,7 +7303,7 @@ QuantizePVT$2.LARGE_BITS = 100000;
7302
7303
  QuantizePVT$2.IXMAX_VAL = 8206;
7303
7304
 
7304
7305
  function QuantizePVT$2() {
7305
-
7306
+ var BitStream = BitStream_1;
7306
7307
  var tak = null;
7307
7308
  var rv = null;
7308
7309
  var psy = null;
@@ -9408,17 +9409,18 @@ var Tables$2 = Tables_1;
9408
9409
  var Encoder$2 = Encoder_1;
9409
9410
  var LameInternalFlags$2 = LameInternalFlags_1;
9410
9411
 
9411
- BitStream$2.EQ = function (a, b) {
9412
+ BitStream$3.EQ = function (a, b) {
9412
9413
  return (Math.abs(a) > Math.abs(b)) ? (Math.abs((a) - (b)) <= (Math
9413
9414
  .abs(a) * 1e-6))
9414
9415
  : (Math.abs((a) - (b)) <= (Math.abs(b) * 1e-6));
9415
9416
  };
9416
9417
 
9417
- BitStream$2.NEQ = function (a, b) {
9418
- return !BitStream$2.EQ(a, b);
9418
+ BitStream$3.NEQ = function (a, b) {
9419
+ return !BitStream$3.EQ(a, b);
9419
9420
  };
9420
9421
 
9421
- function BitStream$2() {
9422
+ function BitStream$3() {
9423
+ var Lame = Lame_1;
9422
9424
  var self = this;
9423
9425
  var CRC16_POLYNOMIAL = 0x8005;
9424
9426
 
@@ -9495,7 +9497,6 @@ function BitStream$2() {
9495
9497
  if (bufBitIdx == 0) {
9496
9498
  bufBitIdx = 8;
9497
9499
  bufByteIdx++;
9498
- assert$5(bufByteIdx < Lame.LAME_MAXMP3BUFFER);
9499
9500
  assert$5(gfc.header[gfc.w_ptr].write_timing >= totbit);
9500
9501
  if (gfc.header[gfc.w_ptr].write_timing == totbit) {
9501
9502
  putheader_bits(gfc);
@@ -9523,7 +9524,6 @@ function BitStream$2() {
9523
9524
  if (bufBitIdx == 0) {
9524
9525
  bufBitIdx = 8;
9525
9526
  bufByteIdx++;
9526
- assert$5(bufByteIdx < Lame.LAME_MAXMP3BUFFER);
9527
9527
  buf[bufByteIdx] = 0;
9528
9528
  }
9529
9529
 
@@ -10368,7 +10368,7 @@ function BitStream$2() {
10368
10368
 
10369
10369
  }
10370
10370
 
10371
- var BitStream_1 = BitStream$2;
10371
+ var BitStream_1 = BitStream$3;
10372
10372
 
10373
10373
  var common$6 = common$o;
10374
10374
  var System$2 = common$6.System;
@@ -10385,35 +10385,36 @@ var LameInternalFlags$1 = LameInternalFlags_1;
10385
10385
  var ATH = ATH_1;
10386
10386
  var ReplayGain = ReplayGain_1;
10387
10387
  var CBRNewIterationLoop = CBRNewIterationLoop_1;
10388
- var BitStream$1 = BitStream_1;
10388
+ var BitStream$2 = BitStream_1;
10389
10389
  var Tables$1 = Tables_1;
10390
10390
  var Encoder$1 = Encoder_1;
10391
10391
 
10392
- function Lame$1() {
10392
+ function Lame$2() {
10393
+ var MPEGMode = MPEGMode_1;
10393
10394
  var self = this;
10394
10395
  var LAME_MAXALBUMART = (128 * 1024);
10395
10396
 
10396
- Lame$1.V9 = 410;
10397
- Lame$1.V8 = 420;
10398
- Lame$1.V7 = 430;
10399
- Lame$1.V6 = 440;
10400
- Lame$1.V5 = 450;
10401
- Lame$1.V4 = 460;
10402
- Lame$1.V3 = 470;
10403
- Lame$1.V2 = 480;
10404
- Lame$1.V1 = 490;
10405
- Lame$1.V0 = 500;
10397
+ Lame$2.V9 = 410;
10398
+ Lame$2.V8 = 420;
10399
+ Lame$2.V7 = 430;
10400
+ Lame$2.V6 = 440;
10401
+ Lame$2.V5 = 450;
10402
+ Lame$2.V4 = 460;
10403
+ Lame$2.V3 = 470;
10404
+ Lame$2.V2 = 480;
10405
+ Lame$2.V1 = 490;
10406
+ Lame$2.V0 = 500;
10406
10407
 
10407
10408
  /* still there for compatibility */
10408
10409
 
10409
- Lame$1.R3MIX = 1000;
10410
- Lame$1.STANDARD = 1001;
10411
- Lame$1.EXTREME = 1002;
10412
- Lame$1.INSANE = 1003;
10413
- Lame$1.STANDARD_FAST = 1004;
10414
- Lame$1.EXTREME_FAST = 1005;
10415
- Lame$1.MEDIUM = 1006;
10416
- Lame$1.MEDIUM_FAST = 1007;
10410
+ Lame$2.R3MIX = 1000;
10411
+ Lame$2.STANDARD = 1001;
10412
+ Lame$2.EXTREME = 1002;
10413
+ Lame$2.INSANE = 1003;
10414
+ Lame$2.STANDARD_FAST = 1004;
10415
+ Lame$2.EXTREME_FAST = 1005;
10416
+ Lame$2.MEDIUM = 1006;
10417
+ Lame$2.MEDIUM_FAST = 1007;
10417
10418
 
10418
10419
  /**
10419
10420
  * maximum size of mp3buffer needed if you encode at most 1152 samples for
@@ -10421,7 +10422,7 @@ function Lame$1() {
10421
10422
  * (LAME_MAXMP3BUFFER is now obsolete)
10422
10423
  */
10423
10424
  var LAME_MAXMP3BUFFER = (16384 + LAME_MAXALBUMART);
10424
- Lame$1.LAME_MAXMP3BUFFER = LAME_MAXMP3BUFFER;
10425
+ Lame$2.LAME_MAXMP3BUFFER = LAME_MAXMP3BUFFER;
10425
10426
 
10426
10427
  var ga;
10427
10428
  var bs;
@@ -11136,7 +11137,7 @@ function Lame$1() {
11136
11137
 
11137
11138
  if (gfp.VBR == VbrMode$3.vbr_off && gfp.brate == 0) {
11138
11139
  /* no bitrate or compression ratio specified, use 11.025 */
11139
- if (BitStream$1.EQ(gfp.compression_ratio, 0))
11140
+ if (BitStream$2.EQ(gfp.compression_ratio, 0))
11140
11141
  gfp.compression_ratio = 11.025;
11141
11142
  /*
11142
11143
  * rate to compress a CD down to exactly 128000 bps
@@ -11906,7 +11907,7 @@ function Lame$1() {
11906
11907
  /* Apply user defined re-scaling */
11907
11908
 
11908
11909
  /* user selected scaling of the samples */
11909
- if (BitStream$1.NEQ(gfp.scale, 0) && BitStream$1.NEQ(gfp.scale, 1.0)) {
11910
+ if (BitStream$2.NEQ(gfp.scale, 0) && BitStream$2.NEQ(gfp.scale, 1.0)) {
11910
11911
  for (i = 0; i < nsamples; ++i) {
11911
11912
  in_buffer[0][i] *= gfp.scale;
11912
11913
  if (gfc.channels_out == 2)
@@ -11915,16 +11916,16 @@ function Lame$1() {
11915
11916
  }
11916
11917
 
11917
11918
  /* user selected scaling of the channel 0 (left) samples */
11918
- if (BitStream$1.NEQ(gfp.scale_left, 0)
11919
- && BitStream$1.NEQ(gfp.scale_left, 1.0)) {
11919
+ if (BitStream$2.NEQ(gfp.scale_left, 0)
11920
+ && BitStream$2.NEQ(gfp.scale_left, 1.0)) {
11920
11921
  for (i = 0; i < nsamples; ++i) {
11921
11922
  in_buffer[0][i] *= gfp.scale_left;
11922
11923
  }
11923
11924
  }
11924
11925
 
11925
11926
  /* user selected scaling of the channel 1 (right) samples */
11926
- if (BitStream$1.NEQ(gfp.scale_right, 0)
11927
- && BitStream$1.NEQ(gfp.scale_right, 1.0)) {
11927
+ if (BitStream$2.NEQ(gfp.scale_right, 0)
11928
+ && BitStream$2.NEQ(gfp.scale_right, 1.0)) {
11928
11929
  for (i = 0; i < nsamples; ++i) {
11929
11930
  in_buffer[1][i] *= gfp.scale_right;
11930
11931
  }
@@ -12218,12 +12219,13 @@ function Lame$1() {
12218
12219
 
12219
12220
  }
12220
12221
 
12221
- var Lame_1 = Lame$1;
12222
+ var Lame_1 = Lame$2;
12222
12223
 
12223
12224
  var common$5 = common$o;
12224
12225
  var VbrMode$2 = common$5.VbrMode;
12225
12226
 
12226
12227
  function Presets$1() {
12228
+ var Lame = Lame_1;
12227
12229
  function VBRPresets(qual, comp, compS,
12228
12230
  y, shThreshold, shThresholdS,
12229
12231
  adj, adjShort, lower,
@@ -15576,15 +15578,15 @@ var common = common$o;
15576
15578
  var new_byte = common.new_byte;
15577
15579
  var assert = common.assert;
15578
15580
 
15579
- Lame = Lame_1;
15580
- Presets = Presets_1;
15581
- GainAnalysis = GainAnalysis_1;
15582
- QuantizePVT = QuantizePVT_1;
15583
- Quantize = Quantize_1;
15584
- Takehiro = Takehiro_1;
15585
- Reservoir = Reservoir_1;
15586
- MPEGMode = MPEGMode_1;
15587
- BitStream = BitStream_1;
15581
+ var Lame$1 = Lame_1;
15582
+ var Presets = Presets_1;
15583
+ var GainAnalysis$1 = GainAnalysis_1;
15584
+ var QuantizePVT = QuantizePVT_1;
15585
+ var Quantize = Quantize_1;
15586
+ var Takehiro = Takehiro_1;
15587
+ var Reservoir = Reservoir_1;
15588
+ var MPEGMode = MPEGMode_1;
15589
+ var BitStream$1 = BitStream_1;
15588
15590
  var Version = Version_1;
15589
15591
  var VBRTag = VBRTag_1;
15590
15592
 
@@ -15617,10 +15619,10 @@ function Mp3Encoder(channels, samplerate, kbps) {
15617
15619
  samplerate = 44100;
15618
15620
  kbps = 128;
15619
15621
  }
15620
- var lame = new Lame();
15622
+ var lame = new Lame$1();
15621
15623
  var gaud = new GetAudio();
15622
- var ga = new GainAnalysis();
15623
- var bs = new BitStream();
15624
+ var ga = new GainAnalysis$1();
15625
+ var bs = new BitStream$1();
15624
15626
  var p = new Presets();
15625
15627
  var qupvt = new QuantizePVT();
15626
15628
  var qu = new Quantize();