.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_3_1_2_stft.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_3_1_2_stft.py: ======================= STFT of an Audio Signal ======================= Figure 3.4 from the tutorial. .. GENERATED FROM PYTHON SOURCE LINES 16-34 .. image-sg:: /auto_examples/images/sphx_glr_plot_3_1_2_stft_001.png :alt: Squared modulus of the STFT of the word GABOR :srcset: /auto_examples/images/sphx_glr_plot_3_1_2_stft_001.png :class: sphx-glr-single-img .. code-block:: default from os.path import dirname, abspath, join from scipy.io import loadmat import numpy as np import matplotlib.pyplot as plt DATA_PATH = join(abspath(dirname("__file__")), "data", "gabor.mat") signal = loadmat(DATA_PATH)['gabor'].ravel() tfr = loadmat(DATA_PATH)['tfr'] time = np.arange(338) freq = np.arange(128, dtype=float) / 256.0 * 1000 plt.contour(time, freq, tfr) plt.grid(True) plt.xlabel('Time [ms]') plt.ylabel('Frequency [Hz]') plt.title('Squared modulus of the STFT of the word GABOR') plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.146 seconds) .. _sphx_glr_download_auto_examples_plot_3_1_2_stft.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_3_1_2_stft.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_3_1_2_stft.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_