@remotion/media-utils 4.0.252 → 4.0.253

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.
@@ -1 +1 @@
1
- export declare const getWaveformSamples: (waveform: Float32Array, sampleAmount: number) => number[];
1
+ export declare const getWaveformSamples: (waveform: Float32Array, sampleAmount: number) => any[];
@@ -19,7 +19,12 @@ const filterData = (audioBuffer, samples) => {
19
19
  };
20
20
  const normalizeData = (filteredData) => {
21
21
  const max = Math.max(...filteredData);
22
- const multiplier = max === 0 ? 0 : max ** -1;
22
+ // If the maximum amplitude is below this threshold, treat it as silence
23
+ const MINIMUM_AMPLITUDE_THRESHOLD = 0.001;
24
+ if (max < MINIMUM_AMPLITUDE_THRESHOLD) {
25
+ return new Array(filteredData.length).fill(0);
26
+ }
27
+ const multiplier = max ** -1;
23
28
  return filteredData.map((n) => n * multiplier);
24
29
  };
25
30
  const getWaveformSamples = (waveform, sampleAmount) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-utils"
4
4
  },
5
5
  "name": "@remotion/media-utils",
6
- "version": "4.0.252",
6
+ "version": "4.0.253",
7
7
  "description": "Utilities for working with media files",
8
8
  "main": "dist/index.js",
9
9
  "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.252"
16
+ "remotion": "4.0.253"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "eslint": "9.14.0",
24
- "@remotion/eslint-config-internal": "4.0.252"
24
+ "@remotion/eslint-config-internal": "4.0.253"
25
25
  },
26
26
  "keywords": [
27
27
  "remotion",