Spaces:
Running
Running
Update index.html
Browse files- index.html +25 -22
index.html
CHANGED
@@ -375,28 +375,31 @@ function extractFeatures(essentia, audioData) {
|
|
375 |
}
|
376 |
};
|
377 |
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
|
|
|
|
|
|
400 |
|
401 |
frames.delete();
|
402 |
return features;
|
|
|
375 |
}
|
376 |
};
|
377 |
|
378 |
+
for (let i = 0; i < frames.size(); i++) {
|
379 |
+
const frame = frames.get(i);
|
380 |
+
|
381 |
+
// ウィンドウ処理 → スペクトル変換(共通処理)
|
382 |
+
const windowed = essentia.Windowing(frame, 'hann', frameSize, false);
|
383 |
+
const spectrum = essentia.Spectrum(windowed);
|
384 |
+
|
385 |
+
// MFCC
|
386 |
+
const mfccResult = essentia.MFCC(spectrum);
|
387 |
+
features.mfcc.push(mfccResult.mfcc); // .mfcc 部分だけ取り出して保存
|
388 |
+
|
389 |
+
// スペクトル特徴量
|
390 |
+
features.spectral.centroid.push(
|
391 |
+
essentia.SpectralCentroid(spectrum).centroid
|
392 |
+
);
|
393 |
+
features.spectral.rolloff.push(
|
394 |
+
essentia.SpectralRollOff(spectrum, 0.85).rollOff
|
395 |
+
);
|
396 |
+
features.spectral.flux.push(
|
397 |
+
essentia.Flux(spectrum).flux
|
398 |
+
);
|
399 |
+
|
400 |
+
frame.delete(); // メモリ解放(必要であれば)
|
401 |
+
}
|
402 |
+
|
403 |
|
404 |
frames.delete();
|
405 |
return features;
|