/** * Quick loop comparison utility * @param {AudioBuffer} buffer1 - First audio buffer * @param {AudioBuffer} buffer2 - Second audio buffer * @returns {Promise} Comparison result */ export function compareLoops(buffer1: AudioBuffer, buffer2: AudioBuffer): Promise; /** * Complete DJ Loop Analyzer Class * Provides intelligent loop analysis, similarity matching, and organization */ export class DJLoopAnalyzer { loops: Map; similarityMatrix: any[]; clusters: any; analysisCache: Map; /** * Analyze a loop and extract all features * @param {AudioBuffer} audioBuffer - Audio buffer to analyze * @param {Object} metadata - Additional metadata * @returns {Promise} Complete loop analysis */ analyzeLoop(audioBuffer: AudioBuffer, metadata?: any): Promise; /** * Extract comprehensive audio features * @param {Float32Array} audioData - Audio time series * @param {number} sampleRate - Sample rate * @returns {Promise} Extracted features */ extractAllFeatures(audioData: Float32Array, sampleRate: number): Promise; /** * Find similar loops using DTW and multiple feature comparison * @param {string} loopId - Target loop ID * @param {Object} options - Search options * @returns {Array} Similar loops ranked by similarity */ findSimilarLoops(loopId: string, options?: any): any[]; /** * Calculate chroma similarity using DTW * @param {Object} loop1 - First loop * @param {Object} loop2 - Second loop * @returns {number} Similarity score (0-1) */ calculateChromaSimilarity(loop1: any, loop2: any): number; /** * Fallback chroma similarity using mean vectors * @param {Object} loop1 - First loop * @param {Object} loop2 - Second loop * @returns {number} Similarity score */ fallbackChromaSimilarity(loop1: any, loop2: any): number; /** * Calculate tempo similarity * @param {Object} loop1 - First loop * @param {Object} loop2 - Second loop * @param {number} tolerance - BPM tolerance * @returns {number} Similarity score (0-1) */ calculateTempoSimilarity(loop1: any, loop2: any, tolerance: number): number; /** * Calculate energy similarity * @param {Object} loop1 - First loop * @param {Object} loop2 - Second loop * @returns {number} Similarity score (0-1) */ calculateEnergySimilarity(loop1: any, loop2: any): number; /** * Calculate key compatibility using Camelot Wheel * @param {Object} key1 - First key * @param {Object} key2 - Second key * @returns {number} Compatibility score (0-1) */ calculateKeyCompatibility(key1: any, key2: any): number; /** * Cluster loops into similar groups * @param {number} nClusters - Number of clusters * @returns {Array} Cluster results */ clusterLoops(nClusters?: number): any[]; /** * Analyze cluster characteristics — every value is measured from the * member loops (no fabricated defaults). * @param {Array} members - Cluster member loop objects * @returns {Object} Cluster characteristics */ analyzeClusterCharacteristics(members: any[]): any; /** * Fallback clustering by tempo * @param {number} nClusters - Number of clusters * @returns {Array} Tempo-based clusters */ fallbackClustering(nClusters: number): any[]; /** * Get harmonic mixing suggestions * @param {string} currentLoopId - Currently playing loop * @returns {Array} Harmonically compatible loops */ getHarmonicMixingOptions(currentLoopId: string): any[]; /** * Generate automatic tags based on features * @param {Object} features - Extracted features * @returns {Array} Generated tags */ generateTags(features: any): any[]; /** * Helper methods */ generateCacheKey(audioData: any): string; computeChromaMean(chroma: any): Float32Array; calculateOverallEnergy(features: any): number; calculateComplexity(features: any): number; /** * Krumhansl-Schmuckler key estimation: Pearson correlation between the * mean chroma vector and each rotated key profile. Confidence is the best * correlation clamped to [0, 1] — a normalized figure, not the raw * (scale-dependent) profile dot product. */ estimateKey(chroma: any): { key: string; confidence: number; mode: string; tonic: string; }; /** * Timbral descriptors, measured from the signal (documented proxies): * - brightness: mean spectral centroid normalized by Nyquist (0..1) * - roughness: mean spectral flatness (0 tonal .. 1 noisy) * - warmth: 1 − mean spectral rolloff (85%) / Nyquist (0..1) * @param {Float32Array} audioData * @param {number} sampleRate * @returns {{brightness: number, roughness: number, warmth: number}} */ extractTimbralFeatures(audioData: Float32Array, sampleRate: number): { brightness: number; roughness: number; warmth: number; }; extractEnergyFeatures(audioData: any, onsetEnv: any): { rms: number; peak: number; crest_factor: number; dynamic_range: number; onset_density: number; }; analyzeStructure(onsetEnv: any, beatTimes: any): { hasBreakdown: any; hasDrop: any; beatCount: any; structuralComplexity: number; }; /** * Structural complexity measured from the onset envelope. The envelope is * split into up to 16 equal segments; the coefficient of variation of the * per-segment mean energy is soft-squashed to [0, 1) via `cv / (1 + cv)`. * A steady loop has near-uniform segment energy (low value); breakdowns, * drops and build-ups raise the segment-to-segment variance (high value). * Measured from the signal — never a fabricated constant, never NaN. * @param {ArrayLike} onsetEnv - Onset strength envelope * @returns {number} Complexity in [0, 1) */ computeStructuralComplexity(onsetEnv: ArrayLike): number; updateSimilarityMatrix(): void; }