fix: expose physical aliasing and delayed arrivals

This commit is contained in:
2026-08-29 10:21:33 +09:00
parent e048ccbadc
commit de0053eae3
38 changed files with 3086 additions and 214 deletions
+2 -7
View File
@@ -1,5 +1,6 @@
import { fftInPlace } from "./fft.js";
import { cooperativeYield } from "./cooperative-yield.js";
import { observeFrequencyBand } from "./sampling.js";
function throwIfAborted(signal) {
if (signal?.aborted) {
@@ -119,11 +120,5 @@ export async function extractStftBins(channels, options) {
}
export function binsForBand(band, sampleRate, fftSize) {
const binWidth = sampleRate / fftSize;
const firstBin = Math.max(0, Math.ceil(band.minHz / binWidth));
const lastBin = Math.min(fftSize / 2, Math.floor(band.maxHz / binWidth));
if (firstBin > lastBin) {
throw new Error(`${band.minHz}–${band.maxHz} Hz에 해당하는 FFT bin이 없습니다.`);
}
return Array.from({ length: lastBin - firstBin + 1 }, (_, index) => firstBin + index);
return observeFrequencyBand(band, sampleRate, fftSize).bins;
}