{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "In this notebook, we summarize the various variants for computing and interpreting a discrete STFT, while fixing the conventions we use throughout the FMP notebooks (if not specified otherwise explicitly). For details on the STFT, we refer to Section 2.1.4 and Section 2.5.3 of [Müller, FMP, Springer 2015].\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Time Axis Conventions for Sampled Signals\n", "\n", "Let $x=(x(0),x(1), \\ldots x(L-1))^\\top \\in \\mathbb{R}^L$ be a discrete-time signal of length $L\\in\\mathbb{N}$. Furthermore, let $F_\\mathrm{s}$ be the sample rate. Then, we associate to $x$ the vector $t=(t(0),t(1), \\ldots t(L-1))^\\top \\in \\mathbb{R}^L$ of physical time positions (given in seconds) defined by\n", "\n", "$$\n", " t(n) = \\frac{n}{F_\\mathrm{s}}\n", "$$\n", "\n", "for $n\\in[0:L-1]$. In other words:\n", "\n", "* The sample $x(0)$ is associated to physical time $t(0)=0$ (given in seconds).\n", "* The duration (given in seconds) of the signal $x$ is the number of samples divided by the sampling rate: $L/F_\\mathrm{s}$. Note that this is **not** the same as $t(L-1)=(L-1)/F_\\mathrm{s}$.\n", "* The distance between two samples $x(n-1)$ and $x(n)$ (called the **sampling period**) is $1/F_\\mathrm{s}$.\n", "\n", "The following code shows how to visualize a waveform using a physical time axis specified in seconds." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-02-15T09:00:22.934306Z", "iopub.status.busy": "2024-02-15T09:00:22.934035Z", "iopub.status.idle": "2024-02-15T09:00:25.521903Z", "shell.execute_reply": "2024-02-15T09:00:25.521262Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "t[0] = 0.0000, t[-1] = (L-1)/Fs = 4.2317, Fs = 11025, L = 46656, dur_x=4.2318\n" ] }, { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |