| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Try it in the browser: Spectrogram. Runs on this package, nothing is uploaded.
Canonical STFT for the @audio ecosystem — batch / stream / analyse, stream ≡ batch under any chunking.
Hann analysis + synthesis windows with correctly normalized overlap-add. Extracted verbatim from @audio/denoise-core (differential-tested there since wave 1), including the shared stream ring-compaction fix.
import { stftBatch, stftStream, stftAnalyse } from '@audio/stft'
// process(mag, phase, state, ctx) → { mag, phase }, called per frame
const identity = (mag, phase) => ({ mag, phase })
// batch — whole signal in, Float32Array out
let out = stftBatch(input, identity, { fs: 44100, frameSize: 2048, hopSize: 512 })
// stream — real-time chunks; identical output to batch for any chunk sizes
let s = stftStream(identity, { fs: 44100 })
let piece = s.write(chunk) // returns processed samples as they become available
let tail = s.flush()
// analyse — visit magnitude/phase frames without resynthesis
stftAnalyse(input, (mag, phase, ctx) => { /* inspect */ }, { fs: 44100 })Also exports wrapPhase, hannWindow, normFloor, PI2 (window math shared with @audio/window).
MIT
| Back | FazBrowse Home | New Git URL |