summaryrefslogtreecommitdiff
path: root/src/dft.h
diff options
context:
space:
mode:
authorsteven-na <noreply.github@stvnc.dev>2026-08-05 21:23:31 -0700
committersteven-na <noreply.github@stvnc.dev>2026-08-05 21:23:31 -0700
commit1646dfb9159e66c30821a5659e8f0a5eb3d52f05 (patch)
treef6d4b6a876af0d35af832e8cdc312ff8777f548c /src/dft.h
parente0e52953570caea66096cda08dc814f34735f7af (diff)
Formatting, bug fix, test coverage
Diffstat (limited to 'src/dft.h')
-rw-r--r--src/dft.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dft.h b/src/dft.h
index 6b63175..4834bce 100644
--- a/src/dft.h
+++ b/src/dft.h
@@ -39,7 +39,10 @@ typedef struct {
typedef struct {
stft_segment_t * segments;
u64 segment_count;
+ u64 window_size;
+ u64 hop_size;
u64 sample_rate;
+ u64 total_samples;
} stft_data_t;
/// Byte alignment required for a samples buffer to safely back
@@ -59,6 +62,9 @@ stft_data_t short_time_fourier_transform(smrt_arena_t * arena ,
u64 sample_rate);
/// Run inverse FFT on a complex spectrum (real/imag, length sample_count).
+/// No 1/N normalization is applied here: real/imag must already be a correctly-scaled
+/// full N-point spectrum (e.g. as produced by reconstruct_spectrum), not a raw
+/// forward-FFT output, or the result will be off by a factor of N.
/// Pass NULL for either out-param to skip allocating/returning that component
void inverse_fast_fourier_transform(smrt_arena_t * arena ,
f64 const * real ,
@@ -68,11 +74,9 @@ void inverse_fast_fourier_transform(smrt_arena_t * arena ,
f64 ** imag_o ,
smrt_arena_t **conflicts, u64 num_conflicts);
-/// Reconstruct samples from STFT data via overlap-add inverse FFT synthesis
+/// Reconstruct samples from STFT data via overlap-add inverse FFT synthesis.
f64 *inverse_short_time_fourier_transform( smrt_arena_t * arena ,
stft_data_t stft ,
- u64 window_size ,
- u64 hop_size ,
smrt_arena_t **conflicts, u64 num_conflicts);
/// Reconstruct a full N-point complex spectrum from one-sided DFT amplitude/phase data