@viji-dev/core 0.3.20 → 0.3.21

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
@@ -1,13 +1,14 @@
1
- /* Excluded from this release type: AnalysisConfiguration */
2
-
3
1
  declare interface AudioAnalysisState {
4
2
  isConnected: boolean;
5
3
  currentBPM: number;
6
4
  confidence: number;
7
- mode: 'auto' | 'manual';
8
- tapCount: number;
9
5
  isLocked: boolean;
10
- sensitivity: number;
6
+ trackingState: string;
7
+ onsetModes: {
8
+ kick: OnsetMode;
9
+ snare: OnsetMode;
10
+ hat: OnsetMode;
11
+ };
11
12
  }
12
13
 
13
14
  export declare interface AudioAPI {
@@ -36,6 +37,7 @@ export declare interface AudioAPI {
36
37
  any: number;
37
38
  kickSmoothed: number;
38
39
  snareSmoothed: number;
40
+ hatSmoothed: number;
39
41
  anySmoothed: number;
40
42
  triggers: {
41
43
  any: boolean;
@@ -49,19 +51,15 @@ export declare interface AudioAPI {
49
51
  strength: number;
50
52
  }>;
51
53
  bpm: number;
52
- phase: number;
53
- bar: number;
54
54
  confidence: number;
55
55
  isLocked: boolean;
56
56
  };
57
57
  spectral: {
58
58
  brightness: number;
59
59
  flatness: number;
60
- flux: number;
61
60
  };
62
61
  getFrequencyData: () => Uint8Array;
63
- getWaveform?: (samples?: number) => Float32Array;
64
- getFFT?: (bins?: number, scale?: 'linear' | 'log') => Float32Array;
62
+ getWaveform: () => Float32Array;
65
63
  }
66
64
 
67
65
  /**
@@ -73,7 +71,7 @@ export declare interface AudioAPI {
73
71
  * - Beat detection with automatic BPM tracking
74
72
  * - Onset detection for audio-reactive triggers
75
73
  * - Smooth energy curves with envelope followers
76
- * - Tap tempo and manual BPM control
74
+ * - Per-instrument onset tap patterns with automatic pattern recognition
77
75
  * - Auto-gain normalization
78
76
  * - Spectral feature extraction
79
77
  * - AudioContext management and cleanup
@@ -88,28 +86,18 @@ export declare class AudioSystem {
88
86
  private analysisMode;
89
87
  private workletNode;
90
88
  private workletReady;
89
+ private workletRegistered;
91
90
  private currentSampleRate;
92
- private pcmRing;
93
- private pcmWriteIndex;
94
- private pcmFilled;
95
- private pcmHistorySeconds;
96
- private lastTempoExtraction;
97
- private tempoExtractionIntervalMs;
98
- private analysisBackend;
99
91
  private bandNoiseFloor;
100
92
  /** Tracks the last non-zero BPM chosen for output to avoid dropping to 0 */
101
93
  private lastNonZeroBpm;
102
94
  /** Tracks which source provided the current BPM (pll | tempo | carry | default) */
103
95
  private lastBpmSource;
104
- private aubioWarningLogged;
105
- private useEssentiaTempo;
106
96
  private workletFrameCount;
107
- private forceAnalyser;
108
- private statusLogTimer;
109
- private isAudioLab;
97
+ private lastFrameTime;
98
+ private stalenessTimer;
99
+ private static readonly STALENESS_THRESHOLD_MS;
110
100
  private analysisTicks;
111
- private lastLoopWarn;
112
- private verboseLabLogs;
113
101
  private lastPhaseLogTime;
114
102
  private onsetLogBuffer;
115
103
  private debugMode;
@@ -126,18 +114,12 @@ export declare class AudioSystem {
126
114
  private rawBandsPreGain;
127
115
  /** Last dt used in analysis loop (ms) */
128
116
  private lastDtMs;
129
- /** Flag to disable auto-gain for debugging */
130
- private debugDisableAutoGain;
131
117
  /** Flag to track if we've logged detection method (to avoid spam) */
132
118
  private readonly bandNames;
133
119
  private essentiaBandHistories;
134
120
  private readonly essentiaHistoryWindowMs;
135
- private beatMode;
136
- private manualBPM;
137
- private tapHistory;
138
- private tapTimeout;
121
+ private onsetTapManager;
139
122
  private envelopeFollowers;
140
- private sensitivity;
141
123
  private beatDetectionEnabled;
142
124
  private onsetDetectionEnabled;
143
125
  private autoGainEnabled;
@@ -156,11 +138,6 @@ export declare class AudioSystem {
156
138
  private updateEssentiaBandHistories;
157
139
  private getEssentiaBandHistory;
158
140
  private getEssentiaAllHistories;
159
- private logVerbose;
160
- /**
161
- * Start/stop periodic status logging. If maxSamples provided, stops after that many ticks.
162
- */
163
- private toggleStatusLogger;
164
141
  /**
165
142
  * Handle frames pushed from AudioWorklet
166
143
  */
@@ -185,14 +162,6 @@ export declare class AudioSystem {
185
162
  * Spectral features from magnitude spectrum
186
163
  */
187
164
  private calculateSpectralFeaturesFromMagnitude;
188
- /**
189
- * Append PCM frame to ring buffer for periodic Essentia tempo extraction
190
- */
191
- private appendPcmFrame;
192
- /**
193
- * Periodically estimate tempo using Essentia's RhythmExtractor2013 (offline chunk)
194
- */
195
- private runEssentiaTempoEstimate;
196
165
  /**
197
166
  * Run onset + beat detection pipeline and return BeatState
198
167
  */
@@ -202,7 +171,6 @@ export declare class AudioSystem {
202
171
  */
203
172
  private debugLog;
204
173
  private fftSize;
205
- private smoothingTimeConstant;
206
174
  private analysisInterval;
207
175
  private analysisIntervalMs;
208
176
  private frequencyData;
@@ -215,11 +183,11 @@ export declare class AudioSystem {
215
183
  private fftPhase;
216
184
  private hannWindow;
217
185
  private audioState;
186
+ private lastWaveformFrame;
218
187
  private analysisLoopId;
219
188
  private isAnalysisRunning;
220
189
  private lastAnalysisTimestamp;
221
190
  private sendAnalysisResults;
222
- private prevSpectralCentroid;
223
191
  constructor(sendAnalysisResultsCallback?: (data: any) => void);
224
192
  /**
225
193
  * Prepare FFT buffers and windowing for the selected fftSize
@@ -254,18 +222,16 @@ export declare class AudioSystem {
254
222
  any: number;
255
223
  kickSmoothed: number;
256
224
  snareSmoothed: number;
225
+ hatSmoothed: number;
257
226
  anySmoothed: number;
258
227
  events: BeatEvent[];
259
228
  bpm: number;
260
- phase: number;
261
- bar: number;
262
229
  confidence: number;
263
230
  isLocked: boolean;
264
231
  };
265
232
  spectral: {
266
233
  brightness: number;
267
234
  flatness: number;
268
- flux: number;
269
235
  };
270
236
  };
271
237
  /**
@@ -282,7 +248,6 @@ export declare class AudioSystem {
282
248
  */
283
249
  handleAudioStreamUpdate(data: {
284
250
  audioStream?: MediaStream | null;
285
- analysisConfig?: AnalysisConfiguration;
286
251
  timestamp: number;
287
252
  }): void;
288
253
  /**
@@ -293,10 +258,6 @@ export declare class AudioSystem {
293
258
  * Disconnect current audio stream and clean up resources
294
259
  */
295
260
  private disconnectAudioStream;
296
- /**
297
- * Update analysis configuration
298
- */
299
- private updateAnalysisConfig;
300
261
  /**
301
262
  * Initialize audio worklet for high-quality capture (complex STFT path)
302
263
  */
@@ -309,6 +270,8 @@ export declare class AudioSystem {
309
270
  * Stop the audio analysis loop
310
271
  */
311
272
  private stopAnalysisLoop;
273
+ private startStalenessTimer;
274
+ private stopStalenessTimer;
312
275
  /**
313
276
  * Pause audio analysis (for tests or temporary suspension)
314
277
  * The setInterval continues but performAnalysis() exits early
@@ -345,68 +308,29 @@ export declare class AudioSystem {
345
308
  */
346
309
  resetAudioState(): void;
347
310
  /**
348
- * Get current analysis configuration
349
- */
350
- getAnalysisConfig(): {
351
- fftSize: number;
352
- smoothing: number;
353
- };
354
- /**
355
- * Set analysis backend preference
356
- */
357
- setAnalysisBackend(backend: 'auto' | 'essentia' | 'custom' | 'aubio'): void;
358
- getAnalysisBackend(): 'auto' | 'essentia' | 'custom' | 'aubio';
359
- /**
360
- * Force analyser path (skip worklet) for debugging
361
- */
362
- setForceAnalyser(enabled: boolean): void;
363
- isForceAnalyser(): boolean;
364
- /**
365
- * Enable/disable Essentia tempo extraction (disabled by default due to WASM exception config)
366
- */
367
- setEssentiaTempoEnabled(enabled: boolean): void;
368
- isEssentiaTempoEnabled(): boolean;
369
- /**
370
- * Set global sensitivity multiplier
371
- * @param value - Sensitivity (0.5-2.0, default 1.0)
372
- */
373
- setSensitivity(value: number): void;
374
- /**
375
- * Get current sensitivity
311
+ * Record a tap for the specified instrument onset
376
312
  */
377
- getSensitivity(): number;
313
+ tapOnset(instrument: InstrumentType): void;
378
314
  /**
379
- * Tap tempo - record tap for manual BPM
315
+ * Clear tap pattern for an instrument, restoring auto-detection
380
316
  */
381
- tapTempo(): void;
317
+ clearOnsetTap(instrument: InstrumentType): void;
382
318
  /**
383
- * Calculate BPM from tap history
319
+ * Get the current onset mode for an instrument
384
320
  */
385
- private calculateBPMFromTaps;
321
+ getOnsetMode(instrument: InstrumentType): OnsetMode_2;
386
322
  /**
387
- * Start auto-clear timeout for tap tempo
323
+ * Get pattern info for an instrument (null if no pattern recognized)
388
324
  */
389
- private startTapClearTimeout;
325
+ getOnsetPatternInfo(instrument: InstrumentType): PatternInfo | null;
390
326
  /**
391
- * Clear tap tempo history
327
+ * Mute/unmute an instrument onset (suppresses output without destroying state)
392
328
  */
393
- clearTaps(): void;
329
+ setOnsetMuted(instrument: InstrumentType, muted: boolean): void;
394
330
  /**
395
- * Get tap count
331
+ * Check if an instrument onset is muted
396
332
  */
397
- getTapCount(): number;
398
- /**
399
- * Set beat sync mode
400
- */
401
- setBeatMode(mode: 'auto' | 'manual'): void;
402
- /**
403
- * Get beat sync mode
404
- */
405
- getBeatMode(): 'auto' | 'manual';
406
- /**
407
- * Set manual BPM
408
- */
409
- setManualBPM(bpm: number): void;
333
+ isOnsetMuted(instrument: InstrumentType): boolean;
410
334
  /**
411
335
  * Get current BPM (manual or auto-detected)
412
336
  */
@@ -423,10 +347,6 @@ export declare class AudioSystem {
423
347
  * Set FFT size
424
348
  */
425
349
  setFFTSize(size: 2048 | 4096 | 8192): void;
426
- /**
427
- * Set smoothing time constant
428
- */
429
- setSmoothing(value: number): void;
430
350
  /**
431
351
  * Enable/disable auto-gain
432
352
  */
@@ -446,11 +366,13 @@ export declare class AudioSystem {
446
366
  isConnected: boolean;
447
367
  currentBPM: number;
448
368
  confidence: number;
449
- mode: 'auto' | 'manual';
450
- tapCount: number;
451
369
  isLocked: boolean;
452
- sensitivity: number;
453
370
  trackingState: string;
371
+ onsetModes: {
372
+ kick: OnsetMode_2;
373
+ snare: OnsetMode_2;
374
+ hat: OnsetMode_2;
375
+ };
454
376
  };
455
377
  /**
456
378
  * Get current per-frame audio analysis data (for UI display)
@@ -482,18 +404,16 @@ export declare class AudioSystem {
482
404
  any: number;
483
405
  kickSmoothed: number;
484
406
  snareSmoothed: number;
407
+ hatSmoothed: number;
485
408
  anySmoothed: number;
486
409
  events: BeatEvent[];
487
410
  bpm: number;
488
- phase: number;
489
- bar: number;
490
411
  confidence: number;
491
412
  isLocked: boolean;
492
413
  };
493
414
  spectral: {
494
415
  brightness: number;
495
416
  flatness: number;
496
- flux: number;
497
417
  };
498
418
  };
499
419
  /**
@@ -597,7 +517,6 @@ export declare class AudioSystem {
597
517
  };
598
518
  volumeGain: number;
599
519
  dtMs: number;
600
- smoothingTimeConstant: number;
601
520
  analysisIntervalMs: number;
602
521
  events: BeatEvent[];
603
522
  };
@@ -677,7 +596,7 @@ declare interface CoreCapabilities {
677
596
  hasGeneral: boolean;
678
597
  }
679
598
 
680
- declare type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation';
599
+ declare type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';
681
600
 
682
601
  declare type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';
683
602
 
@@ -743,6 +662,61 @@ declare interface DeviceState extends DeviceSensorState {
743
662
  video: VideoAPI | null;
744
663
  }
745
664
 
665
+ declare interface FaceBlendshapes {
666
+ browDownLeft: number;
667
+ browDownRight: number;
668
+ browInnerUp: number;
669
+ browOuterUpLeft: number;
670
+ browOuterUpRight: number;
671
+ cheekPuff: number;
672
+ cheekSquintLeft: number;
673
+ cheekSquintRight: number;
674
+ eyeBlinkLeft: number;
675
+ eyeBlinkRight: number;
676
+ eyeLookDownLeft: number;
677
+ eyeLookDownRight: number;
678
+ eyeLookInLeft: number;
679
+ eyeLookInRight: number;
680
+ eyeLookOutLeft: number;
681
+ eyeLookOutRight: number;
682
+ eyeLookUpLeft: number;
683
+ eyeLookUpRight: number;
684
+ eyeSquintLeft: number;
685
+ eyeSquintRight: number;
686
+ eyeWideLeft: number;
687
+ eyeWideRight: number;
688
+ jawForward: number;
689
+ jawLeft: number;
690
+ jawOpen: number;
691
+ jawRight: number;
692
+ mouthClose: number;
693
+ mouthDimpleLeft: number;
694
+ mouthDimpleRight: number;
695
+ mouthFrownLeft: number;
696
+ mouthFrownRight: number;
697
+ mouthFunnel: number;
698
+ mouthLeft: number;
699
+ mouthLowerDownLeft: number;
700
+ mouthLowerDownRight: number;
701
+ mouthPressLeft: number;
702
+ mouthPressRight: number;
703
+ mouthPucker: number;
704
+ mouthRight: number;
705
+ mouthRollLower: number;
706
+ mouthRollUpper: number;
707
+ mouthShrugLower: number;
708
+ mouthShrugUpper: number;
709
+ mouthSmileLeft: number;
710
+ mouthSmileRight: number;
711
+ mouthStretchLeft: number;
712
+ mouthStretchRight: number;
713
+ mouthUpperUpLeft: number;
714
+ mouthUpperUpRight: number;
715
+ noseSneerLeft: number;
716
+ noseSneerRight: number;
717
+ tongueOut: number;
718
+ }
719
+
746
720
  export declare interface FaceData {
747
721
  id: number;
748
722
  bounds: {
@@ -751,8 +725,12 @@ export declare interface FaceData {
751
725
  width: number;
752
726
  height: number;
753
727
  };
728
+ center: {
729
+ x: number;
730
+ y: number;
731
+ };
754
732
  confidence: number;
755
- landmarks?: {
733
+ landmarks: {
756
734
  x: number;
757
735
  y: number;
758
736
  z?: number;
@@ -771,6 +749,7 @@ export declare interface FaceData {
771
749
  yaw: number;
772
750
  roll: number;
773
751
  };
752
+ blendshapes: FaceBlendshapes;
774
753
  }
775
754
 
776
755
  declare interface FrameRateInfo {
@@ -873,6 +852,8 @@ declare interface ImageParameter {
873
852
  category: ParameterCategory;
874
853
  }
875
854
 
855
+ declare type InstrumentType = 'kick' | 'snare' | 'hat';
856
+
876
857
  export declare interface KeyboardAPI {
877
858
  isPressed(key: string): boolean;
878
859
  wasPressed(key: string): boolean;
@@ -952,6 +933,10 @@ declare interface NumberParameter {
952
933
  category: ParameterCategory;
953
934
  }
954
935
 
936
+ declare type OnsetMode = 'auto' | 'tapping' | 'pattern';
937
+
938
+ declare type OnsetMode_2 = 'auto' | 'tapping' | 'pattern';
939
+
955
940
  export declare interface ParameterAPI {
956
941
  define(groups: ParameterGroup[]): void;
957
942
  [key: string]: any;
@@ -993,6 +978,12 @@ export declare interface ParameterGroup {
993
978
 
994
979
  declare type ParameterValue = string | number | boolean | ImageBitmap | OffscreenCanvas | null;
995
980
 
981
+ declare interface PatternInfo {
982
+ length: number;
983
+ intervals: number[];
984
+ confidence: number;
985
+ }
986
+
996
987
  export declare interface PerformanceStats {
997
988
  frameTime: number;
998
989
  resolution: Resolution;
@@ -1245,6 +1236,7 @@ export declare interface VideoAPI {
1245
1236
  cv: {
1246
1237
  enableFaceDetection(enabled: boolean): Promise<void>;
1247
1238
  enableFaceMesh(enabled: boolean): Promise<void>;
1239
+ enableEmotionDetection(enabled: boolean): Promise<void>;
1248
1240
  enableHandTracking(enabled: boolean): Promise<void>;
1249
1241
  enablePoseDetection(enabled: boolean): Promise<void>;
1250
1242
  enableBodySegmentation(enabled: boolean): Promise<void>;
@@ -1256,10 +1248,11 @@ export declare interface VideoAPI {
1256
1248
  /**
1257
1249
  * Video stream categorization type
1258
1250
  * - main: Primary video with CV processing (viji.video)
1259
- * - additional: Host-provided streams without CV (viji.streams[])
1251
+ * - additional: Host-provided MediaStreams without CV (viji.streams[])
1252
+ * - directFrame: Injected frames from compositor pipeline (viji.streams[], after additional)
1260
1253
  * - device: Device-provided camera streams (device.video)
1261
1254
  */
1262
- export declare type VideoStreamType = 'main' | 'additional' | 'device';
1255
+ export declare type VideoStreamType = 'main' | 'additional' | 'directFrame' | 'device';
1263
1256
 
1264
1257
  export declare interface VijiAPI {
1265
1258
  canvas: OffscreenCanvas;
@@ -1315,6 +1308,9 @@ export declare class VijiCore {
1315
1308
  private config;
1316
1309
  private isHeadless;
1317
1310
  private currentAudioStream;
1311
+ private static readonly ADDITIONAL_STREAM_BASE;
1312
+ private static readonly DEVICE_VIDEO_BASE;
1313
+ private static readonly DIRECT_FRAME_BASE;
1318
1314
  private videoStream;
1319
1315
  private videoStreams;
1320
1316
  private mainVideoCoordinator;
@@ -1351,9 +1347,10 @@ export declare class VijiCore {
1351
1347
  */
1352
1348
  private updateFrameBuffer;
1353
1349
  /**
1354
- * Get latest frame (transfers ownership, zero-copy)
1350
+ * Get latest frame (transfers ownership, zero-copy).
1351
+ * Internal: consumed by getLatestFramesFromSources().
1355
1352
  */
1356
- getLatestFrame(): ImageBitmap | null;
1353
+ private getLatestFrame;
1357
1354
  /**
1358
1355
  * Get latest frames from all linked sources
1359
1356
  */
@@ -1385,11 +1382,6 @@ export declare class VijiCore {
1385
1382
  * No-op for headless cores.
1386
1383
  */
1387
1384
  hide(): void;
1388
- /**
1389
- * Select audio analysis backend
1390
- */
1391
- setAudioAnalysisBackend(backend: 'auto' | 'essentia' | 'custom' | 'aubio'): void;
1392
- getAudioAnalysisBackend(): 'auto' | 'essentia' | 'custom' | 'aubio';
1393
1385
  /**
1394
1386
  * Initializes the core components in sequence
1395
1387
  */
@@ -1470,11 +1462,6 @@ export declare class VijiCore {
1470
1462
  * Inject touch event
1471
1463
  */
1472
1464
  injectTouchEvent(data: TouchEventData): void;
1473
- /**
1474
- * Worker-side stream index offset for direct frame slots.
1475
- * Accounts for main video stream and additional media streams.
1476
- */
1477
- private get directFrameStartIndex();
1478
1465
  /**
1479
1466
  * Ensure the worker has enough direct frame slots prepared.
1480
1467
  * Auto-grows as needed; skips if already sufficient.
@@ -1486,11 +1473,6 @@ export declare class VijiCore {
1486
1473
  * Auto-prepares slots as needed. Transfers ownership of the bitmap (zero-copy).
1487
1474
  */
1488
1475
  injectFrame(bitmap: ImageBitmap, streamIndex: number): void;
1489
- /**
1490
- * Inject frames for all direct-frame stream slots at once (compositor pipeline).
1491
- * Auto-prepares slots on first call. Transfers ownership of all bitmaps (zero-copy).
1492
- */
1493
- injectFrames(bitmaps: ImageBitmap[]): void;
1494
1476
  /**
1495
1477
  * Link this core to receive events from a source core
1496
1478
  * @param syncResolution Smart default: true for headless, false for visible
@@ -1602,35 +1584,19 @@ export declare class VijiCore {
1602
1584
  */
1603
1585
  getVideoStream(): MediaStream | null;
1604
1586
  /**
1605
- * Sets all additional video streams (no CV)
1606
- */
1607
- setVideoStreams(streams: MediaStream[]): Promise<void>;
1608
- /**
1609
- * Gets all additional video streams
1610
- */
1611
- getVideoStreams(): MediaStream[];
1612
- /**
1613
- * Gets video stream at specific index
1614
- */
1615
- getVideoStreamAt(index: number): MediaStream | null;
1616
- /**
1617
- * Adds a video stream
1587
+ * Adds an additional video stream (no CV). Returns its index in viji.streams[].
1618
1588
  */
1619
1589
  addVideoStream(stream: MediaStream): Promise<number>;
1620
1590
  /**
1621
- * Removes video stream at index
1591
+ * Removes an additional video stream by index.
1622
1592
  */
1623
- removeVideoStreamAt(index: number): Promise<void>;
1593
+ removeVideoStream(index: number): Promise<void>;
1624
1594
  /**
1625
- * Removes video stream by reference
1595
+ * Gets the number of additional video streams.
1626
1596
  */
1627
- removeVideoStream(stream: MediaStream): Promise<boolean>;
1597
+ getVideoStreamCount(): number;
1628
1598
  /**
1629
- * Updates video stream at index
1630
- */
1631
- setVideoStreamAt(index: number, stream: MediaStream): Promise<void>;
1632
- /**
1633
- * Reinitializes all additional coordinators
1599
+ * Reinitializes all additional coordinators after array mutation.
1634
1600
  */
1635
1601
  private reinitializeAdditionalCoordinators;
1636
1602
  /**
@@ -1646,54 +1612,59 @@ export declare class VijiCore {
1646
1612
  */
1647
1613
  getInteractionEnabled(): boolean;
1648
1614
  readonly audio: {
1649
- /**
1650
- * Set global audio sensitivity (0.5-2.0, default 1.0)
1651
- */
1652
- setSensitivity: (value: number) => void;
1653
- /**
1654
- * Get current sensitivity
1655
- */
1656
- getSensitivity: () => number;
1657
1615
  /**
1658
1616
  * Beat control namespace
1659
1617
  */
1660
1618
  beat: {
1661
1619
  /**
1662
- * Tap tempo - record tap for manual BPM
1620
+ * Get current BPM (auto-detected)
1663
1621
  */
1664
- tap: () => void;
1622
+ getBPM: () => number;
1665
1623
  /**
1666
- * Clear tap tempo history
1624
+ * Nudge beat phase
1667
1625
  */
1668
- clearTaps: () => void;
1626
+ nudge: (amount: number) => void;
1669
1627
  /**
1670
- * Get tap count
1628
+ * Reset beat phase to next beat
1671
1629
  */
1672
- getTapCount: () => number;
1630
+ resetPhase: () => void;
1631
+ };
1632
+ /**
1633
+ * Per-instrument onset tap control
1634
+ */
1635
+ onset: {
1673
1636
  /**
1674
- * Set beat sync mode
1637
+ * Tap an onset for a specific instrument.
1638
+ * First tap switches the instrument from auto to tapping mode.
1639
+ * If a repeating pattern is recognized, it continues after tapping stops.
1675
1640
  */
1676
- setMode: (mode: "auto" | "manual") => void;
1641
+ tap: (instrument: "kick" | "snare" | "hat") => void;
1677
1642
  /**
1678
- * Get beat sync mode
1643
+ * Clear the tap pattern for an instrument, restoring auto-detection
1679
1644
  */
1680
- getMode: () => "auto" | "manual";
1645
+ clear: (instrument: "kick" | "snare" | "hat") => void;
1681
1646
  /**
1682
- * Set manual BPM
1647
+ * Get onset mode for an instrument: 'auto' | 'tapping' | 'pattern'
1683
1648
  */
1684
- setBPM: (bpm: number) => void;
1649
+ getMode: (instrument: "kick" | "snare" | "hat") => string;
1685
1650
  /**
1686
- * Get current BPM (manual or auto-detected)
1651
+ * Get recognized pattern info for an instrument, or null
1687
1652
  */
1688
- getBPM: () => number;
1653
+ getPatternInfo: (instrument: "kick" | "snare" | "hat") => {
1654
+ length: number;
1655
+ intervals: number[];
1656
+ confidence: number;
1657
+ } | null;
1689
1658
  /**
1690
- * Nudge beat phase
1659
+ * Mute/unmute an instrument onset.
1660
+ * Suppresses all output (auto, tap, pattern) without destroying state.
1661
+ * Unmuting resumes pattern replay in-phase.
1691
1662
  */
1692
- nudge: (amount: number) => void;
1663
+ setMuted: (instrument: "kick" | "snare" | "hat", muted: boolean) => void;
1693
1664
  /**
1694
- * Reset beat phase to next beat
1665
+ * Check if an instrument onset is muted
1695
1666
  */
1696
- resetPhase: () => void;
1667
+ isMuted: (instrument: "kick" | "snare" | "hat") => boolean;
1697
1668
  };
1698
1669
  /**
1699
1670
  * Advanced audio controls
@@ -1703,22 +1674,14 @@ export declare class VijiCore {
1703
1674
  * Set FFT size (2048, 4096, or 8192)
1704
1675
  */
1705
1676
  setFFTSize: (size: 2048 | 4096 | 8192) => void;
1706
- /**
1707
- * Set smoothing time constant (0-1)
1708
- */
1709
- setSmoothing: (value: number) => void;
1710
1677
  /**
1711
1678
  * Enable/disable auto-gain
1712
1679
  */
1713
1680
  setAutoGain: (enabled: boolean) => void;
1714
1681
  /**
1715
- * Enable/disable beat detection
1716
- */
1717
- setBeatDetection: (enabled: boolean) => void;
1718
- /**
1719
- * Enable/disable onset detection
1682
+ * Enable/disable audio analysis debug mode (independent from core debug mode)
1720
1683
  */
1721
- setOnsetDetection: (enabled: boolean) => void;
1684
+ setDebugMode: (enabled: boolean) => void;
1722
1685
  };
1723
1686
  /**
1724
1687
  * Get audio analysis state (metadata)
@@ -1755,18 +1718,16 @@ export declare class VijiCore {
1755
1718
  any: number;
1756
1719
  kickSmoothed: number;
1757
1720
  snareSmoothed: number;
1721
+ hatSmoothed: number;
1758
1722
  anySmoothed: number;
1759
1723
  events: BeatEvent[];
1760
1724
  bpm: number;
1761
- phase: number;
1762
- bar: number;
1763
1725
  confidence: number;
1764
1726
  isLocked: boolean;
1765
1727
  };
1766
1728
  spectral: {
1767
1729
  brightness: number;
1768
1730
  flatness: number;
1769
- flux: number;
1770
1731
  };
1771
1732
  } | {
1772
1733
  isConnected: false;
@@ -1794,6 +1755,7 @@ export declare class VijiCore {
1794
1755
  any: number;
1795
1756
  kickSmoothed: number;
1796
1757
  snareSmoothed: number;
1758
+ hatSmoothed: number;
1797
1759
  anySmoothed: number;
1798
1760
  triggers: {
1799
1761
  any: boolean;
@@ -1802,15 +1764,12 @@ export declare class VijiCore {
1802
1764
  hat: boolean;
1803
1765
  };
1804
1766
  bpm: number;
1805
- phase: number;
1806
- bar: number;
1807
1767
  confidence: number;
1808
1768
  isLocked: false;
1809
1769
  };
1810
1770
  spectral: {
1811
1771
  brightness: number;
1812
1772
  flatness: number;
1813
- flux: number;
1814
1773
  };
1815
1774
  };
1816
1775
  };
@@ -1925,10 +1884,6 @@ export declare interface VijiCoreConfig {
1925
1884
  videoStream?: MediaStream;
1926
1885
  /** Additional video input streams (no CV processing) */
1927
1886
  videoStreams?: MediaStream[];
1928
- /** Audio analysis configuration */
1929
- analysisConfig?: AnalysisConfiguration;
1930
- /** Initial parameter values */
1931
- parameters?: ParameterGroup[];
1932
1887
  /** Disable input processing (for preview instances) */
1933
1888
  noInputs?: boolean;
1934
1889
  /** Enable user interaction events (DOM event capture, disabled in headless by default) */