@waveform-playlist/browser 5.0.0-alpha.7 → 5.0.0-alpha.8

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.d.ts CHANGED
@@ -86,6 +86,13 @@ export declare interface AudioClip {
86
86
  name?: string;
87
87
  /** Optional color for visual distinction */
88
88
  color?: string;
89
+ /**
90
+ * Pre-computed waveform data from waveform-data.js library.
91
+ * When provided, the library will use this instead of computing peaks from the audioBuffer.
92
+ * Supports resampling to different zoom levels and slicing for clip trimming.
93
+ * Load with: `const waveformData = await loadWaveformData('/path/to/peaks.dat')`
94
+ */
95
+ waveformData?: WaveformDataObject;
89
96
  }
90
97
 
91
98
  /**
@@ -114,6 +121,7 @@ export declare interface AudioTrackConfig {
114
121
  offset?: number;
115
122
  fadeIn?: Fade;
116
123
  fadeOut?: Fade;
124
+ waveformData?: WaveformDataObject;
117
125
  }
118
126
 
119
127
  /**
@@ -786,17 +794,6 @@ declare type TrackClipPeaks = ClipPeaks[];
786
794
 
787
795
  export declare type TrackEffectsFunction = (graphEnd: Gain, masterGainNode: ToneAudioNode, isOffline: boolean) => void | (() => void);
788
796
 
789
- /**
790
- * Clip-Based Model Types
791
- *
792
- * These types support a professional multi-track editing model where:
793
- * - Each track can contain multiple audio clips
794
- * - Clips can be positioned anywhere on the timeline
795
- * - Clips have independent trim points (offset/duration)
796
- * - Gaps between clips are silent
797
- * - Clips can overlap (for crossfades)
798
- */
799
-
800
797
  /**
801
798
  * Generic effects function type for track-level audio processing.
802
799
  *
@@ -1373,6 +1370,56 @@ export declare const Waveform: default_2.FC<WaveformProps>;
1373
1370
  */
1374
1371
  declare type WaveformColor = string | WaveformGradient;
1375
1372
 
1373
+ /**
1374
+ * Clip-Based Model Types
1375
+ *
1376
+ * These types support a professional multi-track editing model where:
1377
+ * - Each track can contain multiple audio clips
1378
+ * - Clips can be positioned anywhere on the timeline
1379
+ * - Clips have independent trim points (offset/duration)
1380
+ * - Gaps between clips are silent
1381
+ * - Clips can overlap (for crossfades)
1382
+ */
1383
+
1384
+ /**
1385
+ * WaveformData object from waveform-data.js library.
1386
+ * Supports resample() and slice() for dynamic zoom levels.
1387
+ * See: https://github.com/bbc/waveform-data.js
1388
+ */
1389
+ declare interface WaveformDataObject {
1390
+ /** Sample rate of the original audio */
1391
+ readonly sample_rate: number;
1392
+ /** Number of audio samples per pixel */
1393
+ readonly scale: number;
1394
+ /** Length of waveform data in pixels */
1395
+ readonly length: number;
1396
+ /** Bit depth (8 or 16) */
1397
+ readonly bits: number;
1398
+ /** Duration in seconds */
1399
+ readonly duration: number;
1400
+ /** Number of channels */
1401
+ readonly channels: number;
1402
+ /** Get channel data */
1403
+ channel: (index: number) => {
1404
+ min_array: () => number[];
1405
+ max_array: () => number[];
1406
+ };
1407
+ /** Resample to different scale */
1408
+ resample: (options: {
1409
+ scale: number;
1410
+ } | {
1411
+ width: number;
1412
+ }) => WaveformDataObject;
1413
+ /** Slice a portion of the waveform */
1414
+ slice: (options: {
1415
+ startTime: number;
1416
+ endTime: number;
1417
+ } | {
1418
+ startIndex: number;
1419
+ endIndex: number;
1420
+ }) => WaveformDataObject;
1421
+ }
1422
+
1376
1423
  /**
1377
1424
  * Convert WaveformData to our internal Peaks format
1378
1425
  *