stft — ACOUSTICS transform op

• 데이터 종류: signal → table

• 호출: import fullseye as fs; fs.ledger.stft(x, rate, win=256, hop=None, window='hann', nfft=None, scaling='none')(구현을 직접 호출하려면 import acoustics; acoustics.stft(x, rate, win=256, hop=None, window='hann', nfft=None, scaling='none'), 원장에서 가져오려면 opsacoustics.get("stft"))

사용법

위상을 보존하고 역변환도 되는 단시간 푸리에 변환.

> 아래 상세 설명은 원문입니다 —— 요약과 제목은 번역되어 있습니다.

dsp.spectrogram returns magnitudes, which is all a display needs and strictly less than an analysis needs: a magnitude spectrogram cannot be turned back into a signal, so there is no path in dsp that filters or modifies a signal in the time-frequency plane and comes back. This is that path, and the test of it is that the round trip is exact.

Returns a dict (the transform plus everything istft needs to undo

it):

spectra

complex128 (n_freqs, n_frames), same orientation as

dsp.spectrogram.

freqs, times

bin centre frequencies in Hz and frame start times in seconds. Frame

time 0.0 is the first *original* sample, so the leading pad does not

shift the time axis.

times[0] is therefore negative, and that is the consequence of

the sentence above rather than an error: the first frames start inside

the leading pad. Measured on 1.0 s at 16 kHz with win=256, hop=128,

times[0] = -0.016000 and times[-1] = 1.000000, a span 1.6 %

wider than the record. Do not hand times[0] and times[-1]

straight to a plot's time extent — the picture then claims a

time-frequency surface wider than the recording, whose outermost columns

are half-empty frames. Use times[interior], whose first value is

exactly 0.000000, for anything that has to line up with the signal.

rate, win, hop, nfft, length, pad_left, scale, scaling, window, window_values

the geometry, kept so the inverse needs no arguments.

nola_min

the smallest value of the squared-window overlap sum over the original

samples. Reconstruction divides by this sum, so a value of zero means

some sample is not reconstructible; it is refused up front rather than

producing a hole.

interior

boolean mask over frames, true for the frames that lie entirely inside the original signal. The transform pads by a full window at each end so

that inversion is exact, and the frames straddling that pad see part

zeros — they are correct as coefficients but they are not representative,

and any statistic averaged over *all* frames is therefore biased low.

Measured on 16384 samples of unit-variance white noise, win = 1024,

hop = 512: the "density" spectrum integrates to 0.9073 over all 35

frames and to 0.9933 over the 31 interior ones (the signal's own variance

is 0.9923). spectral_kurtosis uses this mask for exactly that

reason — a half-empty frame looks impulsive.

Normalisation is explicit, because a windowed spectrum has no single natural amplitude and a plausible-looking dB number is the usual result of leaving it implicit. scaling selects a real factor applied to every coefficient, recorded as scale and divided out again by istft:

• "none" (default) — the raw rfft of the windowed frame.

• "amplitude" — 2 / sum(w). A sinusoid of amplitude A sitting on a bin centre then reads |Z| = A. Measured on a 1 kHz, amplitude-0.7 tone at 16 kHz with a 256-sample periodic Hann, over the interior frames:

|Z| ranges 0.699999999999999 to 0.700000000000001.

DC and Nyquist read twice their amplitude under this convention (they are

not two-sided), which is the standard caveat and is not corrected for.

• "density" — sqrt(2 / (rate * sum(w**2))), so |Z|**2 is a single-sided power spectral density in units^2/Hz. Measured on 16384 samples of white noise at 16 kHz (win 1024, hop 512): the PSD integrates to 0.9933 over the interior frames against the record's own variance 0.9923, and to 0.9073 if the pad frames are included — see interior.

Raises ValueError: non-1-D / non-finite / complex / masked input, rate <= 0, a string or bool rate, hop outside [1, win], nfft < win, an unknown window, an all-zero window, a transform over MAX_STFT_ELEMENTS, and a window/hop pair whose squared overlap sum touches zero (NOLA violated — the round trip would be silently lossy).

자세한 사용 가이드

• acoustic_condition_monitoring 패밀리 가이드

참고(샘플 데이터·문헌)

• 샘플 데이터 카탈로그(DL URL / 라이선스) —— 2-D 는 skimage.data(BSD/public)+ 합성, 3-D 는 실데이터 소스(Stanford/PDS 등)의 DL URL.

• 연산자의 내력·참고문헌 —— 이 연산자 족의 바탕이 된 연구/기법의 출처.

• 알고리즘의 정전(저자·연도)과 용도는 위의 패밀리 사용 가이드에 적혀 있습니다.

실행 가능한 예제(이 연산자를 실제로 호출하는 검증된 샘플)

• acoustic_condition_monitoring — py -3.11 examples/acoustic_condition_monitoring.py

타입이 이어지는 다음 연산자(table 를 입력으로 받는 것)

istft

같은 카테고리(transform)

istft · stft_cola_check


*Provenance: acoustics.py — ACOUSTICS 연산자 레지스트리. 이 op 노트는 tools/opdocs.py md 가 자동 생성합니다(직접 편집하지 마세요).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.