{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# STFT of an Audio Signal\n\nFigure 3.4 from the tutorial.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from os.path import dirname, abspath, join\nfrom scipy.io import loadmat\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nDATA_PATH = join(abspath(dirname(\"__file__\")), \"data\", \"gabor.mat\")\nsignal = loadmat(DATA_PATH)['gabor'].ravel()\ntfr = loadmat(DATA_PATH)['tfr']\ntime = np.arange(338)\nfreq = np.arange(128, dtype=float) / 256.0 * 1000\n\nplt.contour(time, freq, tfr)\nplt.grid(True)\nplt.xlabel('Time  [ms]')\nplt.ylabel('Frequency  [Hz]')\nplt.title('Squared modulus of the STFT of the word GABOR')\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}