---
title: "ClikaRT::ops::stft"
sidebar_label: "stft"
description: "Short-time Fourier transform of a real [L] / [B, L] signal: frames of win_length (default n_fft) at hop_length strides (default n_fft/4), windowed by window when given (a [win_length] tensor; absent =…"
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## stft() {#stft}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`stft`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int64_t` `n_fft`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<std::int64_t>` `hop_length` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<std::int64_t>` `win_length` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `window` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `center` `=` `true`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`PadMode`](./index.md#PadMode) `pad_mode` `=` [`PadMode::Reflect`](./index.md#PadMode),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `normalized` `=` `false`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `onesided` `=` `true`<br />
)

</div>

Short-time Fourier transform of a real `[L]` / `[B, L]` signal: frames of `win_length` (default `n_fft`) at `hop_length` strides (default `n_fft/4`), windowed by `window` when given (a `[win_length]` tensor; absent = rectangular). Output `[T, n_freq, 2]` / `[B, T, n_freq, 2]` with `n_freq = n_fft/2 + 1`; frames along the time axis first, interleaved (re, im) pairs. `center` pads `n_fft/2` per side in `pad_mode` before framing; `normalized` scales by `1/sqrt(n_fft)`. Only the one-sided form is served; `onesided = false` refuses.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 3310

</div>
