@waveform-playlist/webaudio-peaks 11.3.1 → 12.0.1
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/README.md +107 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @waveform-playlist/webaudio-peaks
|
|
2
|
+
|
|
3
|
+
Small library to extract min/max peaks from an array of audio samples or a Web Audio `AudioBuffer` — the data waveform renderers draw from. Standalone and framework-agnostic; no dependency on the rest of waveform-playlist beyond a shared types package.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @waveform-playlist/webaudio-peaks
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import extractPeaksFromBuffer from '@waveform-playlist/webaudio-peaks';
|
|
15
|
+
|
|
16
|
+
// From a decoded AudioBuffer
|
|
17
|
+
const audioContext = new AudioContext();
|
|
18
|
+
const response = await fetch('/audio/track.mp3');
|
|
19
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
20
|
+
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
|
21
|
+
|
|
22
|
+
const peakData = extractPeaksFromBuffer(
|
|
23
|
+
audioBuffer,
|
|
24
|
+
1000, // samplesPerPixel
|
|
25
|
+
true, // isMono - merge all channels into one
|
|
26
|
+
0, // cueIn - start sample
|
|
27
|
+
undefined, // cueOut - end sample (defaults to full length)
|
|
28
|
+
16 // bits - 8 or 16
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
console.log(peakData.length); // number of peak pairs
|
|
32
|
+
console.log(peakData.data); // Peaks[] - one entry per channel (or one, if isMono)
|
|
33
|
+
console.log(peakData.bits); // 16
|
|
34
|
+
|
|
35
|
+
// From a raw Float32Array (e.g. one channel pulled from an AudioBuffer,
|
|
36
|
+
// or samples produced by a worker/AudioWorklet)
|
|
37
|
+
const channelData = audioBuffer.getChannelData(0);
|
|
38
|
+
const monoPeaks = extractPeaksFromBuffer(channelData, 1000);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API
|
|
42
|
+
|
|
43
|
+
### `extractPeaksFromBuffer(source, samplesPerPixel?, isMono?, cueIn?, cueOut?, bits?)`
|
|
44
|
+
|
|
45
|
+
Default export. Extracts peaks from an `AudioBuffer` or a `Float32Array`.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
function extractPeaksFromBuffer(
|
|
49
|
+
source: AudioBuffer | Float32Array,
|
|
50
|
+
samplesPerPixel?: number, // samples per peak pair (default: 1000)
|
|
51
|
+
isMono?: boolean, // merge multi-channel input to mono (default: true)
|
|
52
|
+
cueIn?: number, // start sample index (default: 0)
|
|
53
|
+
cueOut?: number, // end sample index (default: source.length)
|
|
54
|
+
bits?: 8 | 16 // peak bit depth (default: 16)
|
|
55
|
+
): PeakData;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- **`source`** — an `AudioBuffer` (all channels are read via `getChannelData`) or a single `Float32Array` of samples.
|
|
59
|
+
- **`samplesPerPixel`** — how many source samples are collapsed into one min/max peak pair. Higher values produce fewer, coarser peaks (typical for zoomed-out views); lower values produce more detail.
|
|
60
|
+
- **`isMono`** — when `true` and the source has multiple channels, all channels are averaged down to a single merged peak channel. When `false`, each channel's peaks are kept separate.
|
|
61
|
+
- **`cueIn` / `cueOut`** — restrict extraction to a sample range within the source, useful for extracting peaks from a trimmed region without decoding a new buffer.
|
|
62
|
+
- **`bits`** — `8` or `16`. Throws if any other value is passed. Peak values are quantized to `Int8Array` or `Int16Array` accordingly, which keeps pre-computed peaks compact to store or transmit.
|
|
63
|
+
|
|
64
|
+
Throws an `Error` if `bits` is not `8` or `16`.
|
|
65
|
+
|
|
66
|
+
### Return value: `PeakData`
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
interface PeakData {
|
|
70
|
+
length: number; // number of peak pairs (per channel)
|
|
71
|
+
data: Peaks[]; // one entry per channel; each is an interleaved [min, max, min, max, ...] typed array
|
|
72
|
+
bits: Bits; // 8 or 16 — the bit depth used to quantize the values
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type Peaks = Int8Array | Int16Array;
|
|
76
|
+
type Bits = 8 | 16;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`Peaks`, `Bits`, and `PeakData` are re-exported from `@waveform-playlist/core` for convenience — you don't need to install `core` separately just to reference these types.
|
|
80
|
+
|
|
81
|
+
### Lower-level helpers
|
|
82
|
+
|
|
83
|
+
The min/max extraction and quantization primitives that `extractPeaksFromBuffer` is built from are also exported directly, for callers assembling their own pipeline (e.g. inside an `AudioWorklet` or a Web Worker where you already have raw channel data):
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { extractPeaks, makeMono, findMinMax, convert, makeTypedArray } from '@waveform-playlist/webaudio-peaks';
|
|
87
|
+
|
|
88
|
+
// Extract peaks for a single channel you already have as a Float32Array
|
|
89
|
+
const channelPeaks = extractPeaks(channelData, 1000, 16);
|
|
90
|
+
|
|
91
|
+
// Merge several per-channel Peaks arrays into one mono Peaks array
|
|
92
|
+
const [mono] = makeMono([leftPeaks, rightPeaks], 16);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- `extractPeaks(channel: Float32Array, samplesPerPixel: number, bits: Bits): Peaks` — extracts interleaved min/max peaks from a single channel.
|
|
96
|
+
- `makeMono(channelPeaks: Peaks[], bits: Bits): Peaks[]` — averages multiple channels' peaks into a single-entry array.
|
|
97
|
+
- `findMinMax(array: Float32Array): { min: number; max: number }` — plain min/max over a typed array segment.
|
|
98
|
+
- `convert(n: number, bits: Bits): number` — quantizes a float peak value (-1..1) to the integer range for the given bit depth.
|
|
99
|
+
- `makeTypedArray(bits: Bits, length: number): Peaks` — allocates an `Int8Array` or `Int16Array`.
|
|
100
|
+
|
|
101
|
+
## Examples & Documentation
|
|
102
|
+
|
|
103
|
+
Guides and full API reference: [naomiaro.github.io/waveform-playlist](https://naomiaro.github.io/waveform-playlist/)
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Peaks, Bits, PeakData } from '@waveform-playlist/core';\n\n/**\n * Find minimum and maximum values in a typed array\n */\nexport function findMinMax(array: Float32Array): { min: number; max: number } {\n let min = Infinity;\n let max = -Infinity;\n\n for (let i = 0; i < array.length; i++) {\n const curr = array[i];\n if (min > curr) {\n min = curr;\n }\n if (max < curr) {\n max = curr;\n }\n }\n\n return { min, max };\n}\n\n/**\n * Convert a float peak to an integer based on bit depth\n */\nexport function convert(n: number, bits: Bits): number {\n const maxValue = Math.pow(2, bits - 1);\n const v = n < 0 ? n * maxValue : n * (maxValue - 1);\n return Math.max(-maxValue, Math.min(maxValue - 1, v));\n}\n\n/**\n * Create a typed array based on bit depth\n */\nexport function makeTypedArray(bits: Bits, length: number): Peaks {\n switch (bits) {\n case 8:\n return new Int8Array(length);\n case 16:\n return new Int16Array(length);\n }\n}\n\n/**\n * Extract peaks from a single audio channel\n */\nexport function extractPeaks(channel: Float32Array, samplesPerPixel: number, bits: Bits): Peaks {\n const chanLength = channel.length;\n const numPeaks = Math.ceil(chanLength / samplesPerPixel);\n\n // Create interleaved array of min,max\n const peaks = makeTypedArray(bits, numPeaks * 2);\n\n for (let i = 0; i < numPeaks; i++) {\n const start = i * samplesPerPixel;\n const end = Math.min((i + 1) * samplesPerPixel, chanLength);\n\n const segment = channel.subarray(start, end);\n const extrema = findMinMax(segment);\n const min = convert(extrema.min, bits);\n const max = convert(extrema.max, bits);\n\n peaks[i * 2] = min;\n peaks[i * 2 + 1] = max;\n }\n\n return peaks;\n}\n\n/**\n * Merge multiple channel peaks into a mono peak array\n */\nexport function makeMono(channelPeaks: Peaks[], bits: Bits): Peaks[] {\n const numChan = channelPeaks.length;\n const weight = 1 / numChan;\n const numPeaks = channelPeaks[0].length / 2;\n const peaks = makeTypedArray(bits, numPeaks * 2);\n\n for (let i = 0; i < numPeaks; i++) {\n let min = 0;\n let max = 0;\n\n for (let c = 0; c < numChan; c++) {\n min += weight * channelPeaks[c][i * 2];\n max += weight * channelPeaks[c][i * 2 + 1];\n }\n\n peaks[i * 2] = min;\n peaks[i * 2 + 1] = max;\n }\n\n // Return in array so channel number counts still work\n return [peaks];\n}\n\n/**\n * Extract peaks from an AudioBuffer or Float32Array for waveform visualization\n *\n * @param source - AudioBuffer or Float32Array to extract peaks from\n * @param samplesPerPixel - Number of audio samples per peak (default: 1000)\n * @param isMono - Whether to merge channels to mono (default: true)\n * @param cueIn - Start index for peak extraction (default: 0)\n * @param cueOut - End index for peak extraction (default: source.length)\n * @param bits - Bit depth for peak data: 8 or 16 (default: 16)\n * @returns PeakData object containing peak arrays for each channel\n */\nexport default function extractPeaksFromBuffer(\n source: AudioBuffer | Float32Array,\n samplesPerPixel: number = 1000,\n isMono: boolean = true,\n cueIn: number = 0,\n cueOut?: number,\n bits: Bits = 16\n): PeakData {\n if (bits !== 8 && bits !== 16) {\n throw new Error('Invalid number of bits specified for peaks. Must be 8 or 16.');\n }\n\n let peaks: Peaks[] = [];\n\n // Check if source is an AudioBuffer or Float32Array\n if ('getChannelData' in source) {\n // AudioBuffer\n const numChan = source.numberOfChannels;\n const actualCueOut = cueOut ?? source.length;\n\n for (let c = 0; c < numChan; c++) {\n const channel = source.getChannelData(c);\n const slice = channel.subarray(cueIn, actualCueOut);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n } else {\n // Float32Array\n const actualCueOut = cueOut ?? source.length;\n const slice = source.subarray(cueIn, actualCueOut);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n\n if (isMono && peaks.length > 1) {\n peaks = makeMono(peaks, bits);\n }\n\n const numPeaks = peaks[0].length / 2;\n\n return {\n length: numPeaks,\n data: peaks,\n bits: bits,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,WAAW,OAAmD;AAC5E,MAAI,MAAM;AACV,MAAI,MAAM;AAEV,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,MAAM,MAAM;AACd,YAAM;AAAA,IACR;AACA,QAAI,MAAM,MAAM;AACd,YAAM;AAAA,IACR;AAAA,EACF;AAEA,SAAO,EAAE,KAAK,IAAI;AACpB;AAKO,SAAS,QAAQ,GAAW,MAAoB;AACrD,QAAM,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC;AACrC,QAAM,IAAI,IAAI,IAAI,IAAI,WAAW,KAAK,WAAW;AACjD,SAAO,KAAK,IAAI,CAAC,UAAU,KAAK,IAAI,WAAW,GAAG,CAAC,CAAC;AACtD;AAKO,SAAS,eAAe,MAAY,QAAuB;AAChE,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,IAAI,UAAU,MAAM;AAAA,IAC7B,KAAK;AACH,aAAO,IAAI,WAAW,MAAM;AAAA,EAChC;AACF;AAKO,SAAS,aAAa,SAAuB,iBAAyB,MAAmB;AAC9F,QAAM,aAAa,QAAQ;AAC3B,QAAM,WAAW,KAAK,KAAK,aAAa,eAAe;AAGvD,QAAM,QAAQ,eAAe,MAAM,WAAW,CAAC;AAE/C,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,QAAQ,IAAI;AAClB,UAAM,MAAM,KAAK,KAAK,IAAI,KAAK,iBAAiB,UAAU;AAE1D,UAAM,UA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UAAM,eAAe,UAAU,OAAO;AACtC,UAAM,QAAQ,OAAO,SAAS,OAAO,YAAY;AACjD,UAAM,KAAK,aAAa,OAAO,iBAAiB,IAAI,CAAC;AAAA,EACvD;AAEA,MAAI,UAAU,MAAM,SAAS,GAAG;AAC9B,YAAQ,SAAS,OAAO,IAAI;AAAA,EAC9B;AAEA,QAAM,WAAW,MAAM,CAAC,EAAE,SAAS;AAEnC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Peaks, Bits, PeakData } from '@waveform-playlist/core';\n\n/**\n * Find minimum and maximum values in a typed array\n */\nexport function findMinMax(array: Float32Array): { min: number; max: number } {\n let min = Infinity;\n let max = -Infinity;\n\n for (let i = 0; i < array.length; i++) {\n const curr = array[i];\n if (min > curr) {\n min = curr;\n }\n if (max < curr) {\n max = curr;\n }\n }\n\n return { min, max };\n}\n\n/**\n * Convert a float peak to an integer based on bit depth\n */\nexport function convert(n: number, bits: Bits): number {\n const maxValue = Math.pow(2, bits - 1);\n const v = n < 0 ? n * maxValue : n * (maxValue - 1);\n return Math.max(-maxValue, Math.min(maxValue - 1, v));\n}\n\n/**\n * Create a typed array based on bit depth\n */\nexport function makeTypedArray(bits: Bits, length: number): Peaks {\n switch (bits) {\n case 8:\n return new Int8Array(length);\n case 16:\n return new Int16Array(length);\n }\n}\n\n/**\n * Extract peaks from a single audio channel\n */\nexport function extractPeaks(channel: Float32Array, samplesPerPixel: number, bits: Bits): Peaks {\n const chanLength = channel.length;\n const numPeaks = Math.ceil(chanLength / samplesPerPixel);\n\n // Create interleaved array of min,max\n const peaks = makeTypedArray(bits, numPeaks * 2);\n\n for (let i = 0; i < numPeaks; i++) {\n const start = i * samplesPerPixel;\n const end = Math.min((i + 1) * samplesPerPixel, chanLength);\n\n const segment = channel.subarray(start, end);\n const extrema = findMinMax(segment);\n const min = convert(extrema.min, bits);\n const max = convert(extrema.max, bits);\n\n peaks[i * 2] = min;\n peaks[i * 2 + 1] = max;\n }\n\n return peaks;\n}\n\n/**\n * Merge multiple channel peaks into a mono peak array\n */\nexport function makeMono(channelPeaks: Peaks[], bits: Bits): Peaks[] {\n const numChan = channelPeaks.length;\n const weight = 1 / numChan;\n const numPeaks = channelPeaks[0].length / 2;\n const peaks = makeTypedArray(bits, numPeaks * 2);\n\n for (let i = 0; i < numPeaks; i++) {\n let min = 0;\n let max = 0;\n\n for (let c = 0; c < numChan; c++) {\n min += weight * channelPeaks[c][i * 2];\n max += weight * channelPeaks[c][i * 2 + 1];\n }\n\n peaks[i * 2] = min;\n peaks[i * 2 + 1] = max;\n }\n\n // Return in array so channel number counts still work\n return [peaks];\n}\n\n/**\n * Extract peaks from an AudioBuffer or Float32Array for waveform visualization\n *\n * @param source - AudioBuffer or Float32Array to extract peaks from\n * @param samplesPerPixel - Number of audio samples per peak (default: 1000)\n * @param isMono - Whether to merge channels to mono (default: true)\n * @param cueIn - Start index for peak extraction (default: 0)\n * @param cueOut - End index for peak extraction (default: source.length)\n * @param bits - Bit depth for peak data: 8 or 16 (default: 16)\n * @returns PeakData object containing peak arrays for each channel\n */\nexport default function extractPeaksFromBuffer(\n source: AudioBuffer | Float32Array,\n samplesPerPixel: number = 1000,\n isMono: boolean = true,\n cueIn: number = 0,\n cueOut?: number,\n bits: Bits = 16\n): PeakData {\n if (bits !== 8 && bits !== 16) {\n throw new Error('Invalid number of bits specified for peaks. Must be 8 or 16.');\n }\n\n let peaks: Peaks[] = [];\n\n // Check if source is an AudioBuffer or Float32Array\n if ('getChannelData' in source) {\n // AudioBuffer\n const numChan = source.numberOfChannels;\n const actualCueOut = cueOut ?? source.length;\n\n for (let c = 0; c < numChan; c++) {\n const channel = source.getChannelData(c);\n const slice = channel.subarray(cueIn, actualCueOut);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n } else {\n // Float32Array\n const actualCueOut = cueOut ?? source.length;\n const slice = source.subarray(cueIn, actualCueOut);\n peaks.push(extractPeaks(slice, samplesPerPixel, bits));\n }\n\n if (isMono && peaks.length > 1) {\n peaks = makeMono(peaks, bits);\n }\n\n const numPeaks = peaks[0].length / 2;\n\n return {\n length: numPeaks,\n data: peaks,\n bits: bits,\n };\n}\n"],"mappings":";AAKO,SAAS,WAAW,OAAmD;AAC5E,MAAI,MAAM;AACV,MAAI,MAAM;AAEV,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,MAAM,MAAM;AACd,YAAM;AAAA,IACR;AACA,QAAI,MAAM,MAAM;AACd,YAAM;AAAA,IACR;AAAA,EACF;AAEA,SAAO,EAAE,KAAK,IAAI;AACpB;AAKO,SAAS,QAAQ,GAAW,MAAoB;AACrD,QAAM,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC;AACrC,QAAM,IAAI,IAAI,IAAI,IAAI,WAAW,KAAK,WAAW;AACjD,SAAO,KAAK,IAAI,CAAC,UAAU,KAAK,IAAI,WAAW,GAAG,CAAC,CAAC;AACtD;AAKO,SAAS,eAAe,MAAY,QAAuB;AAChE,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,IAAI,UAAU,MAAM;AAAA,IAC7B,KAAK;AACH,aAAO,IAAI,WAAW,MAAM;AAAA,EAChC;AACF;AAKO,SAAS,aAAa,SAAuB,iBAAyB,MAAmB;AAC9F,QAAM,aAAa,QAAQ;AAC3B,QAAM,WAAW,KAAK,KAAK,aAAa,eAAe;AAGvD,QAAM,QAAQ,eAAe,MAAM,WAAW,CAAC;AAE/C,WAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,UAAM,QAAQ,IAAI;AAClB,UAAM,MAAM,KAAK,KAAK,IAAI,KAAK,iBAAiB,UAAU;AAE1D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AO;AAEL,UAAM,eAAe,UAAU,OAAO;AACtC,UAAM,QAAQ,OAAO,SAAS,OAAO,YAAY;AACjD,UAAM,KAAK,aAAa,OAAO,iBAAiB,IAAI,CAAC;AAAA,EACvD;AAEA,MAAI,UAAU,MAAM,SAAS,GAAG;AAC9B,YAAQ,SAAS,OAAO,IAAI;AAAA,EAC9B;AAEA,QAAM,WAAW,MAAM,CAAC,EAAE,SAAS;AAEnC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waveform-playlist/webaudio-peaks",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Small library to extract peaks from an array of audio samples or an AudioBuffer from the WebAudio API.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@waveform-playlist/core": "
|
|
39
|
+
"@waveform-playlist/core": "12.6.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"tsup": "^8.
|
|
43
|
-
"typescript": "^5.
|
|
44
|
-
"vitest": "^3.
|
|
42
|
+
"tsup": "^8.5.1",
|
|
43
|
+
"typescript": "^5.9.3",
|
|
44
|
+
"vitest": "^3.2.6"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup",
|