@remotion/media-utils 4.0.135 → 4.0.136

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.
@@ -0,0 +1,4 @@
1
+ export declare const fft: (vector: Int16Array) => [
2
+ number,
3
+ number
4
+ ][];
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // Adapted from node-fft project by Joshua Wong and Ben Bryan
3
+ // https://github.com/vail-systems/node-fft
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.fft = void 0;
6
+ const complex_1 = require("./complex");
7
+ const exponent_1 = require("./exponent");
8
+ const fft = function (vector) {
9
+ const X = [];
10
+ const N = vector.length;
11
+ // Base case is X = x + 0i since our input is assumed to be real only.
12
+ if (N === 1) {
13
+ if (Array.isArray(vector[0])) {
14
+ // If input vector contains complex numbers
15
+ return [[vector[0][0], vector[0][1]]];
16
+ }
17
+ return [[vector[0], 0]];
18
+ }
19
+ // Recurse: all even samples
20
+ const X_evens = (0, exports.fft)(vector.filter((_, ix) => ix % 2 === 0));
21
+ // Recurse: all odd samples
22
+ const X_odds = (0, exports.fft)(vector.filter((__, ix) => ix % 2 === 1));
23
+ // Now, perform N/2 operations!
24
+ for (let k = 0; k < N / 2; k++) {
25
+ // t is a complex number!
26
+ const t = X_evens[k];
27
+ const e = (0, complex_1.complexMultiply)((0, exponent_1.exponent)(k, N), X_odds[k]);
28
+ X[k] = (0, complex_1.complexAdd)(t, e);
29
+ X[k + N / 2] = (0, complex_1.complexSubtract)(t, e);
30
+ }
31
+ return X;
32
+ };
33
+ exports.fft = fft;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/media-utils",
3
- "version": "4.0.135",
3
+ "version": "4.0.136",
4
4
  "description": "Utility functions for audio and video",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -13,7 +13,7 @@
13
13
  "url": "https://github.com/remotion-dev/remotion/issues"
14
14
  },
15
15
  "dependencies": {
16
- "remotion": "4.0.135"
16
+ "remotion": "4.0.136"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",