@waveform-playlist/spectrogram 13.0.5 → 13.0.7
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 +58 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @waveform-playlist/spectrogram
|
|
2
|
+
|
|
3
|
+
React Provider + UI for rendering waveform-playlist tracks as FFT spectrograms — color-mapped time-frequency plots instead of (or alongside) the time-domain waveform.
|
|
4
|
+
|
|
5
|
+
Wraps [`@dawcore/spectrogram`](https://www.npmjs.com/package/@dawcore/spectrogram), which owns the FFT computation, Web Worker, and chunked rendering. This package supplies the React layer: mount `<SpectrogramProvider>` inside `<WaveformPlaylistProvider>` from [`@waveform-playlist/browser`](https://www.npmjs.com/package/@waveform-playlist/browser).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Per-track FFT spectrograms** rendered from the real `AudioBuffer` — no separate analysis step
|
|
10
|
+
- **Render-mode switching** per track — `'waveform'`, `'spectrogram'`, or `'both'` (waveform on top, spectrogram below)
|
|
11
|
+
- **Six built-in color maps** (`viridis`, `magma`, `inferno`, `grayscale`, `igray`, `roseus`) plus custom `[r, g, b]` palettes
|
|
12
|
+
- **Five frequency scales** — linear, logarithmic, mel, bark, erb
|
|
13
|
+
- **Drop-in settings UI** — `<SpectrogramSettingsModal>` (FFT size, hop size, window function, gain/range, frequency bounds) and `<SpectrogramMenuItems>` for a track context menu
|
|
14
|
+
- **Viewport-aware rendering** — a Web Worker pool computes the visible chunks first, then a scroll buffer, then the rest in the background, so long timelines stay responsive
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @waveform-playlist/spectrogram
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires `@waveform-playlist/browser`, `react`, and `styled-components` as peer dependencies (already part of any waveform-playlist React setup). `@dawcore/spectrogram` is a regular dependency and installs automatically.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Wrap your editor with `<SpectrogramProvider>` and set a track's `renderMode`:
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { WaveformPlaylistProvider, Waveform } from '@waveform-playlist/browser';
|
|
30
|
+
import { useAudioTracks } from '@waveform-playlist/browser/tone';
|
|
31
|
+
import { SpectrogramProvider } from '@waveform-playlist/spectrogram';
|
|
32
|
+
|
|
33
|
+
function MyEditor() {
|
|
34
|
+
const { tracks, loading } = useAudioTracks([
|
|
35
|
+
{ src: '/audio/vocals.opus', name: 'Vocals', renderMode: 'spectrogram' },
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
if (loading) return <div>Loading...</div>;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<WaveformPlaylistProvider tracks={tracks}>
|
|
42
|
+
<SpectrogramProvider config={{ fftSize: 2048, frequencyScale: 'mel' }} colorMap="viridis">
|
|
43
|
+
<Waveform />
|
|
44
|
+
</SpectrogramProvider>
|
|
45
|
+
</WaveformPlaylistProvider>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`<SpectrogramProvider>` exposes one config + one color map at a time; per-track overrides come from that track's own `spectrogramConfig` / `spectrogramColorMap` fields, or via `<SpectrogramSettingsModal>` at runtime.
|
|
51
|
+
|
|
52
|
+
## Examples & Documentation
|
|
53
|
+
|
|
54
|
+
Full guide, `SpectrogramConfig` reference, color map / frequency scale tables, and Web Components equivalent: [naomiaro.github.io/waveform-playlist](https://naomiaro.github.io/waveform-playlist/).
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waveform-playlist/spectrogram",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.7",
|
|
4
4
|
"description": "React Provider + UI for spectrograms — wraps @dawcore/spectrogram",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
48
|
"vitest": "^3.2.6",
|
|
49
|
-
"@waveform-playlist/browser": "15.
|
|
49
|
+
"@waveform-playlist/browser": "15.3.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@dawcore/spectrogram": "0.0.
|
|
53
|
-
"@waveform-playlist/core": "12.
|
|
52
|
+
"@dawcore/spectrogram": "0.0.7",
|
|
53
|
+
"@waveform-playlist/core": "12.6.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "^18.0.0",
|
|
57
57
|
"styled-components": "^6.0.0",
|
|
58
|
-
"@waveform-playlist/browser": "^15.
|
|
58
|
+
"@waveform-playlist/browser": "^15.3.4"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsup",
|