{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "<center>\n",
    "    <img src=\"./images/ac_header.png\">\n",
    "</center>\n",
    "\n",
    "### <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.tu-ilmenau.de/mt-ams/personen/schuller-gerald/\">Prof. Dr. -Ing. Gerald Schuller</a> <br> <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.tu-ilmenau.de/mt-ams/lehre/msp-and-adsp-tutorials/\">Jupyter Notebook: Renato Profeta</a> \n",
    "\n",
    "[Applied Media Systems Group](https://www.tu-ilmenau.de/en/applied-media-systems-group/) <br>\n",
    "[Technische Universität Ilmenau](https://www.tu-ilmenau.de/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "# Psychoacoustics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Dp9NhFShaPM?rel=0\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Dp9NhFShaPM?rel=0\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Block Diagram of a Perceptual Audio Encoder"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "<center>\n",
    "    <img src='./images/ac_04_01_psycho1.png' width='900'>\n",
    "</center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "scrolled": true,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Structure of the Human Ear"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/BcVFpv1sczg?rel=0\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/BcVFpv1sczg?rel=0\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "<center>\n",
    "    <img src='./images/ac_04_02_structureEar.png' width='900'>\n",
    "    <cite>Quelle: Ars Auditus; http://www.dasp.uni-wuppertal.de/index.php?id=57, 2010</cite>\n",
    "</center>\n",
    "\n",
    " - eardrum – transforms sound wave into vibrations\n",
    " - ossicular bones - transfer the mechanical vibrations to the cochlea\n",
    " - cochlear structure - induces traveling waves along the length of the basilar membrane\n",
    " - neural receptors - connected along the length of the basilar membrane\n",
    "     - convert these traveling into chemical and electrical signals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "### Cochlea"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "<center>\n",
    "    <img src='./images/ac_04_03_cochlea.png' width='500'>\n",
    "</center>\n",
    "\n",
    " - cochlea of a 5 month old fetus:\n",
    "     - spiral-shaped, fluid-filled structure\n",
    "     - contains the coiled basilar membrane\n",
    " - blue arrow $\\rightarrow$ oval window\n",
    " - yellos arrow $\\rightarrow$ round window\n",
    " \n",
    " <center>\n",
    "    <img src='./images/ac_04_04_cochlea2.png' width='600'>\n",
    "</center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "### Organ of Corti"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " <center>\n",
    "    <img src='./images/ac_04_05_corti.png' width='600'>\n",
    "</center>\n",
    "\n",
    " - organ of corti of a guinea pig\n",
    " - white bar = 20 μm\n",
    " \n",
    " - $\\approx$ 3500 IHC and $\\approx$ 12000 OHC at humans.\n",
    " - hair cells convert fluid motion into electrical impulses in auditory nerve."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "hide_input": true,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://acoustics.org/pressroom/httpdocs/146th/mountain.htm\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"900\"\n",
       "            height=\"600\"\n",
       "            src=\"https://acoustics.org/pressroom/httpdocs/146th/mountain.htm\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.IFrame at 0x11d67e1be08>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import IFrame\n",
    "print('https://acoustics.org/pressroom/httpdocs/146th/mountain.htm')\n",
    "IFrame('https://acoustics.org/pressroom/httpdocs/146th/mountain.htm', width=900, height=600)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "hide_input": true,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "http://147.162.36.50/cochlea/cochleapages/overview/history.htm\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"900\"\n",
       "            height=\"600\"\n",
       "            src=\"http://147.162.36.50/cochlea/cochleapages/overview/history.htm\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.IFrame at 0x11d67e53188>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import IFrame\n",
    "print('http://147.162.36.50/cochlea/cochleapages/overview/history.htm')\n",
    "IFrame('http://147.162.36.50/cochlea/cochleapages/overview/history.htm', width=900, height=600)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/eQEaiZ2j9oc?rel=0\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/eQEaiZ2j9oc?rel=0\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Preprocessing of Sound in the Peripheral System"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/tj069m7BUf0?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/tj069m7BUf0?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - frequency selectivity of the basilar membrane\n",
    " <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_08_basilarMembrane.png' width='600'>\n",
    "    <cite>Source: http://cochlearimplanthelp.com/journey/choosing-a-cochlear-implant/electrodes-and-channels/</cite>\n",
    "    <br>\n",
    "</center>\n",
    "<br>\n",
    " - traveling wave envelopes occur in response to an acoustic tone complex containing e.g. sinusoids of 400 Hz, 1600 Hz and 6400 Hz\n",
    " - peak responses for each sinusoid are localized along the membrane surface, with each peak occurring at a particular distance from the oval window (cochlear \"input\")\n",
    "<center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_06_preprocessing.png' width='700'>\n",
    "    <cite>Source: Yuli You \"Audio Coding Theory and Applications\" </cite>\n",
    "    <br>\n",
    "</center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "## Information Processing in the Auditory System"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - basilar membrane as a filter bank\n",
    " - bank of highly overlapping bandpass filters\n",
    " - the magnitude responses are asymmetric and nonlinear (level dependent)\n",
    " - non-uniform bandwidth, and the bandwidths increase with increasing frequency\n",
    " \n",
    "<center>\n",
    "    <img src='./images/ac_04_07_preprocessing2.png' width='700'>\n",
    "</center>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Sound Perception"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Frequency and Level Range of Human Hearing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/sTGM9FhcNbw?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/sTGM9FhcNbw?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "<center>\n",
    "    <img src='./images/ac_04_09_frequency.png' width='700'>\n",
    "</center>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Threshold in Quiet or the Absolute Threshold"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " - Hearing threshold of 100 persons with normal hearing for \n",
    "   sine tones (50% curve is the median).\n",
    " <br>\n",
    "  <center>\n",
    "    <img src='./images/ac_04_10_threshold.png' width='800'>\n",
    "</center>\n",
    "<br>\n",
    "\n",
    " - Approximations:\n",
    " \n",
    " $$\\large\n",
    " \\dfrac{L_{T_q}}{dB} = 3.64 \\left( \\frac{f}{kHz} \\right)^{-0.8} - \\exp \\left( -0.6\\left(\\dfrac{f}{kHz}-3.3\\right)^2\\right)\n",
    " + 10^{-3}\\left(\\dfrac{f}{kHz}\\right)^4\n",
    " $$\n",
    " <br>\n",
    "   <center>\n",
    "    <img src='./images/ac_04_11_threshold2.png' width='600'>\n",
    "</center>\n",
    " \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Hearing Threshold and Age"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " - Average pure-tone audiograms in dB Hearing Loss in (a) men and (b) women grouped by their age in decades (the parameter is age group in years). The extended high-frequency range is zoomed for clarity.\n",
    " \n",
    "  <br>\n",
    "   <center>\n",
    "    <img src='./images/ac_04_12_threshold_age.png' width='500'>\n",
    "</center>\n",
    "\n",
    "\n",
    " - Pure-tone threshold standard deviation of all participants as a function of frequency (the parameter is age in 10-year groups). \n",
    " \n",
    "   <br>\n",
    "   <center>\n",
    "    <img src='./images/ac_04_13_threshold_age2.png' width='500'>\n",
    "</center>\n",
    "\n",
    "\n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "hide_input": true,
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "http://newt.phys.unsw.edu.au/jw/hearing.html\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"900\"\n",
       "            height=\"600\"\n",
       "            src=\"http://newt.phys.unsw.edu.au/jw/hearing.html\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.IFrame at 0x2c276328f08>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import IFrame\n",
    "print('http://newt.phys.unsw.edu.au/jw/hearing.html')\n",
    "IFrame('http://newt.phys.unsw.edu.au/jw/hearing.html', width=900, height=600)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Loudness"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/BQPVCN1fmSQ?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/BQPVCN1fmSQ?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Loudness LeveL:\n",
    "     - **Loudness N:** psychological concept to describe the magnitude of an <u>auditory sensation</u>, the loudness of a sound (measured in 'sone')\n",
    "     - **loudness level $L_N$** of a sound is measured in **'phon'**\n",
    "     - **$L_N$** of a sound is the sound pressure of a 1 kHz tone which is as loud as the sound\n",
    "     - 1 sone is equivalent to 40 phons, which is defined as the loudness level of a pure 1 kHz tone at $L_N$ 40 dB SPL.\n",
    "     \n",
    "     \n",
    " -  Equal-Loudness Level Contours:\n",
    "     - Equal loudness contours of pure tone sin a free sound field.\n",
    "     - The parameter is expressed in **loudness level**, $L_N$, and loudness, N. Can be observed:\n",
    "         - The sensitivity of the human ear -a function of frequency\n",
    "         - The most sensitive to sounds around 2–4 kHz\n",
    "     \n",
    " <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_14_loudness.png' width='500'>\n",
    "</center>\n",
    "\n",
    " - Loudness Scale:\n",
    "     - aim: double the number of units on this scale means magnitude of sensation is doubled\n",
    "     <br>\n",
    "     $\\rightarrow$ relation between loudness level $L_N$ and the loudness N (rule of thumb):\n",
    "    $$2 \\cdot N \\hat{=} L_N + 10 phon $$\n",
    "     - one potential experiment:\n",
    "     <br>\n",
    "     listen to a sound with $L_{N_1}$ 1and then adjust the same sound until <br>\n",
    "     $N_2 = 2 \\cdot N_1$, then compare $L_{N_1}$ and $L_{N_2}$\n",
    "     \n",
    " <center>\n",
    "<img src='./images/ac_04_15_loudness_scale.png' width='600'>\n",
    "</center>  \n",
    "     "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Critical Bands"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Frequency Grouping in Human Hearing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/UI9Y8B9A__0?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/UI9Y8B9A__0?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Different interpretations that produce the same segmentation:\n",
    "     - Constant distance in the Cochlea\n",
    "     - By using tones under the threshold in quiet, their intensity add up in a critical band and are now audible\n",
    "     - Tones in a critical band above the threshold in quiet: their energy adds up\n",
    " - Formula for the width of the critical bands:\n",
    "     - for frequencies < 500 Hz: Constant 100Hz width\n",
    "     - for frequencies > 500 Hz: 0.2*frequency\n",
    "     \n",
    "<center>\n",
    "<img src='./images/ac_04_16_groupin.jpg' width='600'>\n",
    "    <cite>: Zwicker, Fastl “Psychoacoustics Facts and Models”, p.159 </cite>\n",
    "</center>   \n",
    "     \n",
    " - Critical bandwidth as a function of frequency, that quantifies the cochlear filter passbands.\n",
    " - Approximations for low and high frequency ranges are indicated by broken lines."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "#### Excursus - Critical Bands and Loudness"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Spectral effects -influence of bandwidth:\n",
    "     - bandwidth of the signals plays an important role\n",
    "     - sound level also influence loudness level\n",
    "     - $\\rightarrow$ total sound intensity (SPL) have to be constant to measure loudness as function of bandwidth\n",
    "     - $\\rightarrow$ critical bandwidth\n",
    "  \n",
    "<center>\n",
    "<img src='./images/ac_04_17_bandwidth.png' width='500'>\n",
    "</center>  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "### Bark Scale"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Critical-band concept used in many models and hypothesis <br>\n",
    " $\\rightarrow$ unit was defined leading to so-called critical-band rate scale\n",
    " - scale ranging from 0 –24, unit \"Bark\"\n",
    " - relation between z and f is important for understanding many characteristics of human ear\n",
    "\n",
    "<center>\n",
    "<img src='./images/ac_04_18_bark.png' width='500'>\n",
    "</center> \n",
    "\n",
    " - Critical-band concept used in many models and hypotheses <br>\n",
    " $\\rightarrow$ unit was defined leading to so-called critical-band rate scale\n",
    " - scale ranging from 0 –24, unit \"Bark\"(after Zwicker)\n",
    " - One Bark corresponds to one critical band\n",
    " - Attempt to approximate critical bands with formulas:\n",
    " \n",
    "Critical Bandrate *z*:\n",
    "\n",
    "$$\\large\n",
    "\\dfrac{z}{Bark} = 13 \\arctan \\left( 0.76 \\cdot \\dfrac{f}{kHz} \\right) + 3.5 \\cdot \\arctan \\left( \\dfrac{f}{7.5kHz}\\right)^2$$\n",
    "\n",
    "Critical Bandwidth:\n",
    "\n",
    "$$\\large\n",
    "\\Delta f_b = 25 + 75 \\left( 1 + 1.4 \\left( \\dfrac{f}{kHz} \\right)^2 \\right)^{0.69} $$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Masking"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - data compression:\n",
    "     - exploitation of perception in critical bands with reference to the threshold in quiet is not enough\n",
    "\n",
    "\n",
    " - Basic principle:\n",
    "     - a **test signal**, called a **maskee** is placed at the center frequency of the critical bandwidth.\n",
    "     - one **masking signal**, called **masker** (equal power and distance from maskee).\n",
    "     - If the $P_{maskee}$ is weak relative to the total power of the maskers $\\rightarrow$ the test signal is not audible $\\rightarrow$ test signal is masked\n",
    "     - In order for the test signal to become audible, its power has to be raised to above a certain level – **masking threshold**.\n",
    "     "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/5Er45bT-hOE?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/5Er45bT-hOE?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking of Pure Tones by Noise -Broad-Band Noise"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Broad-band noise:\n",
    "      - white noise from 20 Hz 20 - 20kHz.\n",
    " \n",
    " <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_19_broadnoise.png' width='600'>\n",
    "    <cite> Zwicker, Fastl \"Psychoacoustics - Facts and Models\", 2nd Edition, 1999. </cite>\n",
    "    <br>\n",
    "</center>\n",
    " \n",
    " \n",
    " - masking threshold for pure tones masked by broad band noise of different levels.\n",
    " - uniform masking noise (UMN) by equalization of the 10 dB per decade slope.\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking of Pure Tones by Noise -Narrow-Band Noise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/bHXbgLWkCUk?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/bHXbgLWkCUk?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "hide_input": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - narrow-band noise:\n",
    "     - noise with a bandwidth equal or smaller than critical bandwidth\n",
    "     \n",
    "      <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_20_narrownoise.png' width='600'>\n",
    "    <cite> Zwicker, Fastl \"Psychoacoustics - Facts and Models\", 2nd Edition, 1999. </cite>\n",
    "    <br>\n",
    "</center>\n",
    "     \n",
    "     \n",
    " - threshold of pure tones masked by narrow-band noise for different centre frequencies.\n",
    " - difference between maximum of masked threshold and test tone level.\n",
    " \n",
    "  <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_21_narrownoise2.png' width='600'>\n",
    "    <br>\n",
    "</center>\n",
    "\n",
    " - dependence of masked threshold on level of narrow-band noise.\n",
    " - dips at higher levels  $\\rightarrow$ nonlinear effects (difference noise caused by interactions between test tone and noise)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "scrolled": true,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking of Pure Tones by Low-Pass or High-Pass Noise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/yEc89bIIcAY?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/yEc89bIIcAY?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "scrolled": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "<center>\n",
    "    <img src='./images/ac_04_22_LpHpnoise2.png' width='600'>\n",
    "</center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking of Pure Tones by Pure Tone"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/W01-mvdXP_c?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/W01-mvdXP_c?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - pure tone:\n",
    "     - single frequency\n",
    "     \n",
    " <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_23_pureTone.png' width='600'>\n",
    "    <br>\n",
    "</center>  \n",
    "\n",
    " - 1 kHz masking tone with level of 80 dB.\n",
    " - threshold for 'detection of anything'\n",
    " \n",
    " \n",
    " - Difficulties:\n",
    "     - beats (hatching)\n",
    "     - masker and difference tone (stippling)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking of Pure Tone by Complex Tones"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/zuQzj9cYwnk?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/zuQzj9cYwnk?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - complex tone:\n",
    "     - fundamental tone with its harmonics\n",
    "     \n",
    " <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_24_complexTone.png' width='600'>\n",
    "    <cite> Zwicker, Fastl \"Psychoacoustics - Facts and Models\", 2nd Edition, 1999. </cite>\n",
    "    <br>\n",
    "</center>  \n",
    "\n",
    "\n",
    " - threshold of pure tones masked by a complex tone with 200 Hz fundamental frequency and nine harmonics.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Tonality"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/pyRuUEB8Bqk?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/pyRuUEB8Bqk?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Tonality index $\\alpha$:\n",
    "     - noisy signal: $\\alpha =0$\n",
    "     - tonal signal: $\\alpha =1$\n",
    " - System theory:\n",
    "     - Sharp spectral lines = Signal is periodic = Signal is predictable.\n",
    "     - Approximation: If the signal is predictable then it should be periodic.\n",
    "     - Therefore we can use prediction to approximate if a signal is tonal (by periodicity). \n",
    " - Example:\n",
    "  <center>\n",
    "    <img src='./images/ac_04_25_tonality.png' width='600'>\n",
    "    <br>\n",
    "</center> \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking - Spreading Function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/2aGu9gCB1Ug?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/2aGu9gCB1Ug?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "  <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_26_spreadingF.png' width='900'>\n",
    "    <br>\n",
    "</center> "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Calculating the Masking Threshold"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Comparison of the signal level to Masking Threshold:\n",
    "\n",
    "$$\\large\n",
    "\\dfrac{O_f(i)}{dB} = \\alpha (14.5+i) + (1+\\alpha)\\cdot \\alpha_v$$\n",
    "\n",
    "$$\\large\n",
    "\\alpha_v = -2 - 2.05 \\arctan \\left( \\dfrac{f}{4kHz} \\right) - 0.75 \\arctan \\left( \\dfrac{f^2}{2.56 kHz^2} \\right)$$\n",
    "\n",
    "where $\\alpha \\dots$ Tonality index, $\\alpha_v \\dots$ Noise Coefficient\n",
    "\n",
    " - Approxitamtion:\n",
    "\n",
    "$$\\large\n",
    "\\dfrac{O_f(i)}{dB} = \\alpha(14.5+i) + (1 - \\alpha)\\cdot 5.5 $$\n",
    "\n",
    " - Simultaneous Masking Threshold\n",
    " \n",
    " $$\\large\n",
    " T(f) = 10^{\\frac{L_s(f)- O_f(i)}{10}}$$\n",
    " \n",
    " where $L_s(f) \\dots$ Sound Pressure Level, $O_f{i} \\dots$ Distance to Masking Threshold"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "###  In-Band Making"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "hide_input": true,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/EX7x7LLJRKM?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/EX7x7LLJRKM?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "  <center>\n",
    "    <img src='./images/ac_04_25_inBand.png' width='600'>\n",
    "    <cite> Zolzer, \"Digital Audio Signal Processig\" </cite>\n",
    "</center> \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Masking Neighboring Bands"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - spread of masking due to the non-linearity of auditory filters\n",
    " - resulting masking threshold = sum of power of neighbouring spreading functions-\n",
    " - here: value at intersection of neighbouringspreading functions taken\n",
    "  <center>\n",
    "    <br>\n",
    "    <img src='./images/ac_04_27_maskingBands.png' width='800'>\n",
    "    <cite> Zolzer, \"Digital Audio Signal Processig\" </cite>\n",
    "    <br>\n",
    "</center> \n",
    "\n",
    "\n",
    "$$\\large\n",
    "S_1 = 27 \\cdot \\dfrac{dB}{Bark}$$\n",
    "\n",
    "$$\\large\n",
    "S_2 = 24 + 0.23 \\left( \\dfrac{f}{kHz} \\right)^{-1} - 0.2 \\cdot \\dfrac{L_s(f)}{dB} \\dfrac{dB}{Bark}$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "### Temporal Masking Effects"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "hide_input": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/_TYpk4ekJGs?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%html\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/_TYpk4ekJGs?rel=0\" frameborder=\"0\" allow=\"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    " - Post-Masking: corresponds to decay in the effect of the masker $\\rightarrow$ expected\n",
    " - Pre-Masking: appears during time before masker is switched on:\n",
    "     - Quick build-up time for loud maskers\n",
    "     - Slower build-up time for faint test sounds\n",
    " -  Frequency resolution $\\leftrightarrow$ Blurringing time\n",
    " - Frequency resolution in the ear $\\rightarrow$ Masking in time\n",
    " - Because of in-ear fast processing between quiet to loud signals, we get Pre-Echoes\n",
    "     - Pre-Masking: 1-5 ms\n",
    "     - Post-Masking: ~100ms\n",
    "     \n",
    "       <center>\n",
    "    <img src='./images/ac_04_28_temporal.png' width='800'>\n",
    "    <cite> Zwicker. Fastl \"Psychoacoustics Facts and Models\" </cite>\n",
    "</center> \n",
    "   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.8"
  },
  "livereveal": {
   "rise": {
    "height": "90%",
    "width": "90%"
   },
   "scroll": true,
   "theme": "beige",
   "transition": "zoom"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {
     "0b0c58e6c93a41799e09f406dbdefde6": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "0b3040b1b58e4b53a4509d1a39fd031d": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "0be2682832bd4bc8b51cb737e46ca28c": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "0e39b9742c5341378d14cd0ce7c6d7b2": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_2d9b7d0f8fe4439bb967b502ccdf02f7",
        "IPY_MODEL_7042e1d3ab44462087773c8182c56c15"
       ],
       "layout": "IPY_MODEL_0be2682832bd4bc8b51cb737e46ca28c"
      }
     },
     "0f12a068f35a41949e7af2ab301fb1a9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "15ad70cfa0aa41638667c356ae56295f": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "16c7c2a79a4a4203be047ae7aeee19fa": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_15ad70cfa0aa41638667c356ae56295f",
       "style": "IPY_MODEL_0f12a068f35a41949e7af2ab301fb1a9"
      }
     },
     "1d15c09691004b7080cdbe29a28d73ff": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_e2f6054e0fe24c10ac5c95a2b687f1ca",
        "IPY_MODEL_2cf22153219242b180ccb47bc4b8f968"
       ],
       "layout": "IPY_MODEL_b40a35cef38e4048b6a2d8149ff7e069"
      }
     },
     "207bd58d7ad144f58b70b598ae30db8e": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "20f35183b9e74a438f97507b3d10929a": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "23ef77f7f8a84176907ef6949905623b": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_f61da7386157426ca81a202ffe23e162",
        "IPY_MODEL_77a43b098d01405690eb7f9256544cc1"
       ],
       "layout": "IPY_MODEL_3c3e2637ae684b7e95aca1d49d23f40b"
      }
     },
     "2cf22153219242b180ccb47bc4b8f968": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_207bd58d7ad144f58b70b598ae30db8e",
       "style": "IPY_MODEL_bd80f1c63a2b4a25900e5e5763317b7a"
      }
     },
     "2d9b7d0f8fe4439bb967b502ccdf02f7": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "disabled": true,
       "layout": "IPY_MODEL_77522a5639144548b35db6c4d7dd4fb1",
       "style": "IPY_MODEL_7d63afec39bb49df9edf2873be48ac04"
      }
     },
     "3276b4539f7144b6a21869875e9c4914": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "354ba59a5468408b962c72423d4e1c65": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "3c3e2637ae684b7e95aca1d49d23f40b": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "4131c38460e44eaf962c7017e2536232": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_d58265f7549a4e979a3c65b9bd5d76a5",
        "IPY_MODEL_c5267597c945478f959c375f44a4d1a7"
       ],
       "layout": "IPY_MODEL_4b10bbeb1b794eb697268d9a1bd106ba"
      }
     },
     "435a7872da0d4c41be05e35d3d9570aa": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "4488c6e4c7834e098e81b481cb1003a4": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "CheckboxModel",
      "state": {
       "description": "LP Filters",
       "disabled": false,
       "layout": "IPY_MODEL_a6c7fc4e429c464e8fca3294d830542a",
       "style": "IPY_MODEL_7fc76b30f0904d1ab285f634f82d7054",
       "value": false
      }
     },
     "470de88b8310448d864c97fad609f7de": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "4b10bbeb1b794eb697268d9a1bd106ba": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "5795130576114428a9f5f86ee4aa8c80": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "589c1be4bde643c899cf54d67ebfb42f": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_e8e1025d1bb44a08a500c0d3b8718796",
        "IPY_MODEL_fb8ae2a4374c451eb7d78b16edcca16a"
       ],
       "layout": "IPY_MODEL_354ba59a5468408b962c72423d4e1c65"
      }
     },
     "5e41a5a9f29443f49a84cb3b28cfd887": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "5e7f58b91bbf4d1d839bbf49450afd8f": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_ac4c2b3e307640bdb74f11ec3cf0dafd",
        "IPY_MODEL_e3db17127dba4e609008d860b5cf05c5"
       ],
       "layout": "IPY_MODEL_5e41a5a9f29443f49a84cb3b28cfd887"
      }
     },
     "5ec351197a1c442a8fa816d034b1eef6": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "6341affae71049aba97ec2ad0ff9583d": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "6c0e7d0a22a144458689ec0d86788548": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "6cb680fde00f4a6e8c0fb454c76857d3": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_de5153ef26c14561bb728c1e74b51aac",
       "style": "IPY_MODEL_aed5c18ec1e44b1cb9c1c8a1164530bc"
      }
     },
     "6d9b43798e7642019c6888b869c409a7": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "7042e1d3ab44462087773c8182c56c15": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_d869cf27021149409370838cc26ee878",
       "style": "IPY_MODEL_b5d3845cf20e497ea0bddab2ce24c089"
      }
     },
     "77480c26779c420390eabd1bbd64cbee": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "layout": "IPY_MODEL_7b0edd69218248ec89c22a9b29960928",
       "style": "IPY_MODEL_470de88b8310448d864c97fad609f7de"
      }
     },
     "77522a5639144548b35db6c4d7dd4fb1": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "77a43b098d01405690eb7f9256544cc1": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_5ec351197a1c442a8fa816d034b1eef6",
       "style": "IPY_MODEL_f9ed9f912ac848a1a61cccea6d4c20c3",
       "value": true
      }
     },
     "7b0edd69218248ec89c22a9b29960928": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "7d63afec39bb49df9edf2873be48ac04": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "7e5dc995c0d54dc88ffba21751e34fd0": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "7fc76b30f0904d1ab285f634f82d7054": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "86fd6e4196864369a5e361e09e227412": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "892de2da73f84062be6382bed68d98e9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_77480c26779c420390eabd1bbd64cbee",
        "IPY_MODEL_16c7c2a79a4a4203be047ae7aeee19fa"
       ],
       "layout": "IPY_MODEL_c65da4d48410402ca720e41ea2b1a532"
      }
     },
     "a6c7fc4e429c464e8fca3294d830542a": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "a9d684453fac4de8a1da6b5678a9263d": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_adf8151b53c0458db8a2931959f9851c",
        "IPY_MODEL_6cb680fde00f4a6e8c0fb454c76857d3"
       ],
       "layout": "IPY_MODEL_6c0e7d0a22a144458689ec0d86788548"
      }
     },
     "aba427d2152e4e5b95f68cd5fa6b869a": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "ac4c2b3e307640bdb74f11ec3cf0dafd": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "CheckboxModel",
      "state": {
       "description": "Downsampling/Upsampling",
       "disabled": false,
       "layout": "IPY_MODEL_ccebf79f7b6b4954afc304a9a913fe0b",
       "style": "IPY_MODEL_5795130576114428a9f5f86ee4aa8c80",
       "value": false
      }
     },
     "adf8151b53c0458db8a2931959f9851c": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "layout": "IPY_MODEL_c8e686b7f1fd41fb950f6c64c28d1e38",
       "style": "IPY_MODEL_20f35183b9e74a438f97507b3d10929a"
      }
     },
     "aed5c18ec1e44b1cb9c1c8a1164530bc": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "b40a35cef38e4048b6a2d8149ff7e069": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "b5d3845cf20e497ea0bddab2ce24c089": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "b71122422f634440ba716e8c5537e52d": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "CheckboxModel",
      "state": {
       "description": "Downsampling/Upsampling",
       "disabled": false,
       "layout": "IPY_MODEL_c9f9cd5507994921a16488b925690ec8",
       "style": "IPY_MODEL_e3d4389b65684b879575d18283ac20f2",
       "value": false
      }
     },
     "bd80f1c63a2b4a25900e5e5763317b7a": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "c1d5efb6eefa4af38df3245d97590b3a": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "c5267597c945478f959c375f44a4d1a7": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_6341affae71049aba97ec2ad0ff9583d",
       "style": "IPY_MODEL_c1d5efb6eefa4af38df3245d97590b3a",
       "value": true
      }
     },
     "c65da4d48410402ca720e41ea2b1a532": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "c8e686b7f1fd41fb950f6c64c28d1e38": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "c9f9cd5507994921a16488b925690ec8": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "ccebf79f7b6b4954afc304a9a913fe0b": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "d58265f7549a4e979a3c65b9bd5d76a5": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "disabled": true,
       "layout": "IPY_MODEL_0b0c58e6c93a41799e09f406dbdefde6",
       "style": "IPY_MODEL_7e5dc995c0d54dc88ffba21751e34fd0"
      }
     },
     "d869cf27021149409370838cc26ee878": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "dc8d5864ac8d4bb38cee8d043d030237": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "de5153ef26c14561bb728c1e74b51aac": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "e2f6054e0fe24c10ac5c95a2b687f1ca": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "layout": "IPY_MODEL_dc8d5864ac8d4bb38cee8d043d030237",
       "style": "IPY_MODEL_6d9b43798e7642019c6888b869c409a7"
      }
     },
     "e35d3e4323234d9287de5cd69a13219c": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "e3d4389b65684b879575d18283ac20f2": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "e3db17127dba4e609008d860b5cf05c5": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "CheckboxModel",
      "state": {
       "description": "LP Filters",
       "disabled": false,
       "layout": "IPY_MODEL_3276b4539f7144b6a21869875e9c4914",
       "style": "IPY_MODEL_fbee3d37ce574d8da66ca40eea646dfc",
       "value": false
      }
     },
     "e8e1025d1bb44a08a500c0d3b8718796": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "layout": "IPY_MODEL_0b3040b1b58e4b53a4509d1a39fd031d",
       "style": "IPY_MODEL_e35d3e4323234d9287de5cd69a13219c"
      }
     },
     "f3b755ac64314b4c901f9ecb32965fd6": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.2.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "f61da7386157426ca81a202ffe23e162": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "Start",
       "disabled": true,
       "layout": "IPY_MODEL_f3b755ac64314b4c901f9ecb32965fd6",
       "style": "IPY_MODEL_86fd6e4196864369a5e361e09e227412"
      }
     },
     "f9ed9f912ac848a1a61cccea6d4c20c3": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "fb8ae2a4374c451eb7d78b16edcca16a": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "ToggleButtonModel",
      "state": {
       "description": "Stop",
       "layout": "IPY_MODEL_aba427d2152e4e5b95f68cd5fa6b869a",
       "style": "IPY_MODEL_435a7872da0d4c41be05e35d3d9570aa"
      }
     },
     "fbee3d37ce574d8da66ca40eea646dfc": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.5.0",
      "model_name": "DescriptionStyleModel",
      "state": {
       "description_width": ""
      }
     }
    },
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}