Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: keep computeSongFeatures internal (#9073)

[._.]/ Adam Eivyfd2d4249f912
diff --git a/server/services/musicVideo/audioAnalysis.js b/server/services/musicVideo/audioAnalysis.js
index a3df54cfcb..d397f7a71d 100644
--- a/server/services/musicVideo/audioAnalysis.js
+++ b/server/services/musicVideo/audioAnalysis.js
@@ -737,7 +737,7 @@ function pickBandOnsets(fluxSeries, hopSec) {
* @param {number} sampleRate
* @param {{ truncatedAtSec?: number|null }} [opts] set when the decode was cut short
*/
-export function computeSongFeatures(samples, sampleRate, { truncatedAtSec = null } = {}) {
+function computeSongFeatures(samples, sampleRate, { truncatedAtSec = null } = {}) {
if (!samples || samples.length < FFT_SIZE) return null;
const envHop = Math.round(sampleRate / FEATURE_ENVELOPE_FPS);
const env = bandFrames(samples, sampleRate, envHop);
diff --git a/server/services/musicVideo/audioAnalysis.test.js b/server/services/musicVideo/audioAnalysis.test.js
index 58d5ffcc62..edaca97911 100644
--- a/server/services/musicVideo/audioAnalysis.test.js
+++ b/server/services/musicVideo/audioAnalysis.test.js
@@ -4,7 +4,6 @@ import { tmpdir } from 'os';
import { join } from 'path';
import {
analyzePcm,
- computeSongFeatures,
ANALYSIS_VERSION,
analyzeAudioFile,
decodeAudioToPcm,
@@ -547,7 +546,7 @@ describe('snapSectionsToGrid', () => {
});
});
-describe('computeSongFeatures / analyzePcm feature track (#9073)', () => {
+describe('analyzePcm feature track (#9073)', () => {
const SR = ANALYSIS_SAMPLE_RATE;
const HOP_SEC = 1 / 30;
@@ -614,8 +613,9 @@ describe('computeSongFeatures / analyzePcm feature track (#9073)', () => {
it('reports null features (never empty arrays) for audio too short to analyse, and zeros for silence', () => {
expect(analyzePcm(new Float32Array(100), SR).features).toBeNull();
- expect(computeSongFeatures(new Float32Array(SR), SR).envelopes.low.every((v) => v === 0)).toBe(true);
- expect(computeSongFeatures(new Float32Array(SR), SR).onsets.low).toEqual([]);
+ const silent = analyzePcm(new Float32Array(SR), SR).features;
+ expect(silent.envelopes.low.every((v) => v === 0)).toBe(true);
+ expect(silent.onsets.low).toEqual([]);
});
it('carries a prior feature track (or its absence) through a manual tempo override', () => {