playlist-data-engine 1.5.7 → 1.5.9

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.
@@ -3,7 +3,7 @@ import type { MusicClassificationProfile } from '../types/AudioProfile.js';
3
3
  * Supported model architectures for audio feature extraction.
4
4
  * Each architecture requires different mel-band configurations:
5
5
  * - `musicnn`: 96 mel bands - MusiCNN / MSD style models
6
- * - `effnet`: 128 mel bands - Discogs-EffNet embedding models
6
+ * - `effnet`: 96 mel bands, consumed as 128-frame patches - Discogs-EffNet embedding models
7
7
  * - `vggish`: 64 mel bands - VGGish-based models (e.g., audioset classifiers)
8
8
  * - `tempocnn`: 40 mel bands - TempoCNN-based models (e.g., tempo estimation)
9
9
  */
@@ -192,7 +192,7 @@ export declare function isSingleStepModel(config: ModelConfig): config is Single
192
192
  * Used to select the correct feature extractor (mel-band count) and model class.
193
193
  *
194
194
  * Architecture → Mel Bands mapping:
195
- * - effnet: 128 bands (Discogs-EffNet)
195
+ * - effnet: 96 bands in 128-frame patches (Discogs-EffNet)
196
196
  * - vggish: 64 bands
197
197
  * - tempocnn: 40 bands
198
198
  * - musicnn: 96 bands (default)
@@ -326,7 +326,7 @@ export declare class MusicClassifier {
326
326
  * Architecture-specific feature extractors.
327
327
  * Each architecture requires different mel-band configurations:
328
328
  * - musicnn: 96 bands (default extractor)
329
- * - effnet: 128 bands (custom extractor)
329
+ * - effnet: 96 bands (same TensorflowInputMusiCNN features as musicnn)
330
330
  * - vggish: 64 bands
331
331
  * - tempocnn: 40 bands
332
332
  */
@@ -414,34 +414,20 @@ export declare class MusicClassifier {
414
414
  * Clears all model caches (embedding, classifier, and resolved URLs).
415
415
  */
416
416
  clearAllCaches(): void;
417
- /**
418
- * Computes 128-band mel-spectrogram features for Discogs-EffNet models.
419
- *
420
- * Unlike the standard musicnn extractor (96 bands), EffNet requires 128 mel bands.
421
- * This method uses Essentia WASM's core MelBands algorithm directly.
422
- *
423
- * @param audioSignal - Mono audio signal at 16kHz sample rate
424
- * @returns 2D array of mel-spectrogram frames, shape [frames][128]
425
- */
426
- /**
427
- * Creates a wrapper object that combines EssentiaJS algorithms with WASM utility methods.
428
- * This is needed because EssentiaJS has algorithms (Windowing, Spectrum, etc.) but lacks
429
- * utility methods like arrayToVector/vectorToArray which are on the WASM module directly.
430
- */
431
- private createEssentiaWrapper;
432
- private computeEffnetFeatures;
433
417
  /**
434
418
  * Gets the appropriate mel-spectrogram features for a given model architecture.
435
419
  *
436
420
  * Different architectures require different mel-band configurations:
437
421
  * - musicnn: 96 bands (default)
438
- * - effnet: 128 bands (custom)
422
+ * - effnet: 96 bands (same features as musicnn)
439
423
  * - vggish: 64 bands
440
424
  * - tempocnn: 40 bands
441
425
  *
442
426
  * @param audioSignal - Mono audio signal at 16kHz sample rate
443
427
  * @param architecture - The model architecture type
444
- * @returns 2D array of mel-spectrogram frames
428
+ * @returns For 'effnet': number[][] of mel frames. For all other
429
+ * architectures: the EssentiaTFInputExtractorOutput object that
430
+ * essentia.js model predict() methods expect
445
431
  */
446
432
  private getFeaturesForArchitecture;
447
433
  /**
@@ -452,7 +438,20 @@ export declare class MusicClassifier {
452
438
  /**
453
439
  * Analyzes audio to extract genre, mood, and vibe data.
454
440
  */
455
- analyze(audioUrl: string): Promise<MusicClassificationProfile>;
441
+ /**
442
+ * Analyze a track. Accepts either:
443
+ * - a `string` URL: the engine fetches + decodes + downsamples via Web
444
+ * Audio (main-thread path). Backward-compatible with all existing callers.
445
+ * - an `{ audioSignal, sampleRate? }` object: caller has already fetched,
446
+ * decoded, AND downsampled to mono PCM. Used when running inside a Web
447
+ * Worker (no Web Audio available there). `sampleRate` defaults to 16000
448
+ * (essentia.js's required rate); the engine skips fetch + decode +
449
+ * downsample and runs only the slice + ML inference on the provided signal.
450
+ */
451
+ analyze(input: string | {
452
+ audioSignal: Float32Array;
453
+ sampleRate?: number;
454
+ }): Promise<MusicClassificationProfile>;
456
455
  /**
457
456
  * Runs a classifier model on pre-computed embeddings.
458
457
  *
@@ -461,8 +460,8 @@ export declare class MusicClassifier {
461
460
  * 2. Classifier model produces class predictions from embeddings
462
461
  *
463
462
  * @param classifierUrl - URL to the classifier model (GraphModel format)
464
- * @param embeddings - 2D array of embeddings, shape [frames][embedding_dim]
465
- * @returns Promise resolving to 1D array of averaged class predictions
463
+ * @param embeddings - 2D array of embeddings, shape [patches][embedding_dim]
464
+ * @returns Promise resolving to 1D array of class predictions averaged across patches
466
465
  */
467
466
  private runClassifierOnEmbeddings;
468
467
  /**
@@ -496,13 +495,15 @@ export declare class MusicClassifier {
496
495
  *
497
496
  * EffNet models are TensorFlow.js GraphModels that expect:
498
497
  * - Named inputs discovered dynamically from model signature
499
- * - Mel-spectrogram shape: [batch=64, mel_bands=128, time_frames=96]
498
+ * - Mel-spectrogram shape: [batch=64, time_frames=128, mel_bands=96]
500
499
  *
501
- * The 'bs64' in model name means fixed batch size of 64.
500
+ * The input axis order is time-major: each of the 64 patches is 128
501
+ * consecutive TensorflowInputMusiCNN frames of 96 mel bands. The 'bs64'
502
+ * in the model name means a fixed batch size of 64.
502
503
  *
503
504
  * @param model - TensorFlow.js GraphModel instance
504
- * @param features - 2D array of mel-spectrogram frames, shape [frames][128]
505
- * @returns 2D array of embeddings, shape [segments][embedding_dim]
505
+ * @param features - 2D array of mel-spectrogram frames, shape [frames][96]
506
+ * @returns 2D array of embeddings, one per patch, shape [patches][embedding_dim]
506
507
  */
507
508
  private runEffnetEmbedding;
508
509
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"MusicClassifier.d.ts","sourceRoot":"","sources":["../../../src/core/analysis/MusicClassifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,0BAA0B,EAG7B,MAAM,0BAA0B,CAAC;AAKlC;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAA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O,CAAC,gBAAgB;IAuBxB;;OAEG;IACH;;;;;;;;;OASG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,WAAW,EAAE,YAAY,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IA8JtH;;;;;;;;;;OAUG;YACW,yBAAyB;IA+CvC;;;;;;;;;;;;;;OAcG;YACW,uBAAuB;IA6CrC;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAyD1B;;;;;;;;;;;;;;OAcG;YACW,kBAAkB;IAqHhC;;;;;;;;;OASG;YACW,oBAAoB;IAclC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;YACW,kBAAkB;IAqBhC;;OAEG;YACW,gBAAgB;IA8C9B,OAAO,CAAC,cAAc;CAezB"}
@@ -64,16 +64,32 @@ export declare class MetadataExtractor {
64
64
  */
65
65
  static parseMetadata(metadata: unknown): Record<string, unknown> | null;
66
66
  /**
67
- * Extract genre with support for string or array formats
68
- * - If genre is a string, returns it directly
69
- * - If genre is an array, returns the first element
70
- * - Also checks OpenSea attributes array for "Genre" trait_type
67
+ * Extract genre with support for string or array formats.
68
+ * Sources are checked in priority order; first non-empty wins:
69
+ * - `genre` field as a string
70
+ * - `genre` field as an array (first element)
71
+ * - OpenSea `attributes` array with `trait_type` of "genre" (case-insensitive)
72
+ * - `attributes` as an object keyed by trait name (e.g. `attributes.Genre`)
73
+ * - malformed `attribute ` key (literal trailing space) with `.genre`
74
+ * Stays strict: only fields literally named "genre" are considered
75
+ * (no fallback to `category` or similar).
71
76
  */
72
77
  static extractGenre(data: Record<string, unknown>): string;
73
78
  /**
74
- * Convert OpenSea-style attributes array to key-value object
75
- * Example: [{ trait_type: "BPM", value: 120 }] => { BPM: 120 }
79
+ * Extract tags from track metadata, normalized to a deduped,
80
+ * lowercased, trimmed string[] with empties removed.
81
+ * Sources (concatenated, then deduped):
82
+ * - `tags` field as an array, or a single comma-separated string
83
+ * - `properties.tags` array (when `properties` is an object)
84
+ * - OpenSea `attributes` array with `trait_type` of "tag"/"tags" (case-insensitive)
85
+ * - `attributes` as an object keyed by trait name (e.g. `attributes.Tags`)
76
86
  */
87
+ static extractTags(data: Record<string, unknown>): string[];
88
+ /**
89
+ * Normalize a list of raw tag values into a deduped, lowercased,
90
+ * trimmed string[] with empties removed.
91
+ */
92
+ private static normalizeTags;
77
93
  static convertAttributes(attributes: unknown): Record<string, string | number> | null;
78
94
  /**
79
95
  * Safely extract a URI string from a nested object path.
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataExtractor.d.ts","sourceRoot":"","sources":["../../../src/core/parser/MetadataExtractor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qBAAa,iBAAiB;IAC1B;;;;;;;;;OASG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI;IAYpE;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI;IAY5E;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI;IAsBpE;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI;IAczE;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI;IAUjE;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI;IAsBlE;;;OAGG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