Commit 95677803 authored by Steve Tjoa's avatar Steve Tjoa

stft; chroma

parent 3cf45164
......@@ -11840,6 +11840,17 @@ div#notebook {
<td></td>
<td>Energy</td>
</tr>
<tr>
<td>Spectrogram</td>
<td><a href="stft.html">STFT and Spectrogram</a></td>
<td><a href="https://en.wikipedia.org/wiki/Spectrogram">Spectrogram</a></td>
<td></td>
<td>29, 55</td>
<td>STFT</td>
</tr>
<tr>
<td>Short-time Fourier transform</td>
</tr>
</tbody>
</table>
......
......@@ -29,7 +29,9 @@
"source": [
"|Term|musicinformationretrieval.com|Wikipedia|librosa|FMP|Related|\n",
"|-|-|-|-|-|-|\n",
"|Root-mean-square energy|[Energy and RMSE](energy.html)|[Root mean square](https://en.wikipedia.org/wiki/Root_mean_square)|[`librosa.feature.rmse`](https://librosa.github.io/librosa/generated/librosa.feature.rmse.html)| |Energy|\n"
"|Root-mean-square energy|[Energy and RMSE](energy.html)|[Root mean square](https://en.wikipedia.org/wiki/Root_mean_square)|[`librosa.feature.rmse`](https://librosa.github.io/librosa/generated/librosa.feature.rmse.html)| |Energy|\n",
"|Spectrogram|[STFT and Spectrogram](stft.html)|[Spectrogram](https://en.wikipedia.org/wiki/Spectrogram)||29, 55|STFT|\n",
"|Short-time Fourier transform|\n"
]
},
{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11863,8 +11863,8 @@ div#notebook {
<li><a href="energy.html">Energy and RMSE</a> (<a href="energy.ipynb">ipynb</a>)</li>
<li><a href="zcr.html">Zero Crossing Rate</a> (<a href="zcr.ipynb">ipynb</a>)</li>
<li><a href="fourier_transform.html">Fourier Transform</a> (<a href="fourier_transform.ipynb">ipynb</a>)</li>
<li><a href="stft.html">Short-Time Fourier Transform and CQT</a> (<a href="stft.ipynb">ipynb</a>)</li>
<li><a href="chroma.html">Chroma</a> (<a href="chroma.ipynb">ipynb</a>)</li>
<li><a href="stft.html">Short-time Fourier Transform and Spectrogram</a> (<a href="stft.ipynb">ipynb</a>)</li>
<li><a href="chroma.html">Constant-Q Transform and Chroma</a> (<a href="chroma.ipynb">ipynb</a>)</li>
<li><a href="spectral_features.html">Spectral Features</a> (<a href="spectral_features.ipynb">ipynb</a>)</li>
<li><a href="autocorrelation.html">Autocorrelation</a> (<a href="autocorrelation.ipynb">ipynb</a>)</li>
<li><a href="pitch_transcription_exercise.html">Pitch Transcription Exercise</a> (<a href="pitch_transcription_exercise.ipynb">ipynb</a>)</li>
......
......@@ -75,8 +75,8 @@
"1. [Energy and RMSE](energy.html) ([ipynb](energy.ipynb))\n",
"1. [Zero Crossing Rate](zcr.html) ([ipynb](zcr.ipynb))\n",
"1. [Fourier Transform](fourier_transform.html) ([ipynb](fourier_transform.ipynb))\n",
"1. [Short-Time Fourier Transform and CQT](stft.html) ([ipynb](stft.ipynb))\n",
"1. [Chroma](chroma.html) ([ipynb](chroma.ipynb))\n",
"1. [Short-time Fourier Transform and Spectrogram](stft.html) ([ipynb](stft.ipynb))\n",
"1. [Constant-Q Transform and Chroma](chroma.html) ([ipynb](chroma.ipynb))\n",
"1. [Spectral Features](spectral_features.html) ([ipynb](spectral_features.ipynb))\n",
"1. [Autocorrelation](autocorrelation.html) ([ipynb](autocorrelation.ipynb))\n",
"1. [Pitch Transcription Exercise](pitch_transcription_exercise.html) ([ipynb](pitch_transcription_exercise.ipynb))"
......
......@@ -11773,7 +11773,7 @@ div#notebook {
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[1]:</div>
<div class="prompt input_prompt">In&nbsp;[4]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="o">%</span><span class="k">matplotlib</span> inline
......@@ -11809,14 +11809,41 @@ div#notebook {
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Let's listen to a file:</p>
<p>Musical signals are highly non-stationary, i.e., their statistics change over time. It would be rather meaningless to compute a single Fourier transform over an entire 10-minute song.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The <strong>short-time Fourier transform (STFT)</strong> (<a href="https://en.wikipedia.org/wiki/Short-time_Fourier_transform">Wikipedia</a>; FMP, p. 53) is obtained by computing the Fourier transform for successive frames in a signal.</p>
$$ X(m, \omega) = \sum_n x(n) w(n-m) e^{-j \omega n} $$
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>As we increase $m$, we slide the window function $w$ to the right. For the resulting frame, $x(n) w(n-m)$, we compute the Fourier transform. Therefore, the STFT $X$ is a function of both time, $m$, and frequency, $\omega$.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Let's load a file:</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[2]:</div>
<div class="prompt input_prompt">In&nbsp;[20]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="n">x</span><span class="p">,</span> <span class="n">sr</span> <span class="o">=</span> <span class="n">librosa</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">&#39;audio/simple_piano.wav&#39;</span><span class="p">)</span>
......@@ -11833,7 +11860,7 @@ div#notebook {
<div class="output_area">
<div class="prompt output_prompt">Out[2]:</div>
<div class="prompt output_prompt">Out[20]:</div>
......@@ -11851,6 +11878,156 @@ div#notebook {
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><a href="https://librosa.github.io/librosa/generated/librosa.core.stft.html#librosa.core.stft"><code>librosa.stft</code></a> computes a STFT. We provide it a frame size, i.e. the size of the FFT, and a hop length, i.e. the frame increment:</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[21]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="n">hop_length</span> <span class="o">=</span> <span class="mi">512</span>
<span class="n">n_fft</span> <span class="o">=</span> <span class="mi">2048</span>
<span class="n">X</span> <span class="o">=</span> <span class="n">librosa</span><span class="o">.</span><span class="n">stft</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">n_fft</span><span class="o">=</span><span class="n">n_fft</span><span class="p">,</span> <span class="n">hop_length</span><span class="o">=</span><span class="n">hop_length</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>To convert the hop length and frame size to units of seconds:</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[22]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="nb">float</span><span class="p">(</span><span class="n">hop_length</span><span class="p">)</span><span class="o">/</span><span class="n">sr</span> <span class="c1"># units of seconds</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[22]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>0.023219954648526078</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[23]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="nb">float</span><span class="p">(</span><span class="n">n_fft</span><span class="p">)</span><span class="o">/</span><span class="n">sr</span> <span class="c1"># units of seconds</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[23]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>0.09287981859410431</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>For real-valued signals, the Fourier transform is symmetric about the midpoint. Therefore, <code>librosa.stft</code> only retains one half of the output:</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[24]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="n">X</span><span class="o">.</span><span class="n">shape</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[24]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>(1025, 166)</pre>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>This STFT has 1025 frequency bins and 166 frames in time.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
......@@ -11864,17 +12041,214 @@ div#notebook {
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Musical signals are highly non-stationary, i.e., their statistics change over time. It would be rather meaningless to compute a single spectrum over an entire 10-minute song.</p>
<p>Instead, we compute a spectrum for small frames of the audio signal. The resulting sequence of spectra is called a <a href="https://en.wikipedia.org/wiki/Spectrogram"><em>spectrogram</em></a>.</p>
<p>In music processing, we often only care about the spectral magnitude and not the phase content.</p>
<p>The <strong>spectrogram</strong> (<a href="https://en.wikipedia.org/wiki/Spectrogram">Wikipedia</a>; FMP, p. 29, 55) shows the the intensity of frequencies over time. A spectrogram is simply the squared magnitude of the STFT:</p>
$$ S(m, \omega) = \left| X(m, \omega) \right|^2 $$
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>The human perception of sound intensity is logarithmic in nature. Therefore, we are often interested in the log amplitude:</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[25]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="n">S</span> <span class="o">=</span> <span class="nb">abs</span><span class="p">(</span><span class="n">X</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>To display any type of spectrogram in librosa, use <a href="http://bmcfee.github.io/librosa/generated/librosa.display.specshow.html"><code>librosa.display.specshow</code></a>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[26]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="n">librosa</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">specshow</span><span class="p">(</span><span class="n">S</span><span class="p">,</span> <span class="n">sr</span><span class="o">=</span><span class="n">sr</span><span class="p">,</span> <span class="n">x_axis</span><span class="o">=</span><span class="s1">&#39;time&#39;</span><span class="p">,</span> <span class="n">y_axis</span><span class="o">=</span><span class="s1">&#39;linear&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="prompt output_prompt">Out[26]:</div>
<div class="output_text output_subarea output_execute_result">
<pre>&lt;matplotlib.axes._subplots.AxesSubplot at 0x10e0f3810&gt;</pre>
</div>
</div>
<div class="output_area">
<div class="prompt"></div>
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Sil3JnltkoNJLk/yhdWnfjnJuNb6oVm1DYCt
Z9pYALZFKeWyJH9Qa71sxk0BYBu5QwHAVJRS3pcktdb3lVL+NMlvJbkqyZ8m+XCSf5zkJUl+otZ6
Xynl8iT/Mcnzs7Jy7T+qtT40i7YDcHbGUAAwCy9Kck+t9VVJzk/y12ut1yR5X1ZWqE2SjyZ5Z631
iiQ/neQ3ZtFQANbnDgUAs3LP6r9fTfLpNY+fW0q5MMlrkvxqKeVM/QtLKc+vtT4x3WYCsB6BAoCZ
qLWeWlNc7D29L8mJWusPntlQSnlJku9Oo20AbJ4uTwDsOLXWp5J8qZTy5iQppbw+yR/OtlUATOIO
BQA71d9O8qFSyjuTnEryN2utpiYE2GFMGwsAADTT5QkAAGgmUAAAAM0ECgAAoJlAAQAANBMoAACA
ZgIFAADQTKAAAACaCRQAAECz/wcS9nYb202fEAAAAABJRU5ErkJggg==
"
>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="librosa.feature.melspectrogram"><code>librosa.feature.melspectrogram</code><a class="anchor-link" href="#librosa.feature.melspectrogram">&#194;&#182;</a></h3>
<h2 id="Mel-spectrogram">Mel-spectrogram<a class="anchor-link" href="#Mel-spectrogram">&#194;&#182;</a></h2>
</div>
</div>
</div>
......
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {
"collapsed": true,
"slideshow": {
......@@ -40,6 +40,29 @@
"# Short-Time Fourier Transform"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Musical signals are highly non-stationary, i.e., their statistics change over time. It would be rather meaningless to compute a single Fourier transform over an entire 10-minute song."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The **short-time Fourier transform (STFT)** ([Wikipedia](https://en.wikipedia.org/wiki/Short-time_Fourier_transform); FMP, p. 53) is obtained by computing the Fourier transform for successive frames in a signal. \n",
"\n",
"$$ X(m, \\omega) = \\sum_n x(n) w(n-m) e^{-j \\omega n} $$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As we increase $m$, we slide the window function $w$ to the right. For the resulting frame, $x(n) w(n-m)$, we compute the Fourier transform. Therefore, the STFT $X$ is a function of both time, $m$, and frequency, $\\omega$."
]
},
{
"cell_type": "markdown",
"metadata": {
......@@ -48,12 +71,12 @@
}
},
"source": [
"Let's listen to a file:"
"Let's load a file:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 20,
"metadata": {
"slideshow": {
"slide_type": "subslide"
......@@ -74,7 +97,7 @@
"<IPython.lib.display.Audio object>"
]
},
"execution_count": 2,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
......@@ -84,6 +107,105 @@
"ipd.Audio(x, rate=sr)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[`librosa.stft`](https://librosa.github.io/librosa/generated/librosa.core.stft.html#librosa.core.stft) computes a STFT. We provide it a frame size, i.e. the size of the FFT, and a hop length, i.e. the frame increment:"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"hop_length = 512\n",
"n_fft = 2048\n",
"X = librosa.stft(x, n_fft=n_fft, hop_length=hop_length)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To convert the hop length and frame size to units of seconds:"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.023219954648526078"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"float(hop_length)/sr # units of seconds"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.09287981859410431"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"float(n_fft)/sr # units of seconds"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For real-valued signals, the Fourier transform is symmetric about the midpoint. Therefore, `librosa.stft` only retains one half of the output:"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1025, 166)"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This STFT has 1025 frequency bins and 166 frames in time."
]
},
{
"cell_type": "markdown",
"metadata": {
......@@ -103,20 +225,88 @@
}
},
"source": [
"Musical signals are highly non-stationary, i.e., their statistics change over time. It would be rather meaningless to compute a single spectrum over an entire 10-minute song.\n",
"In music processing, we often only care about the spectral magnitude and not the phase content.\n",
"\n",
"The **spectrogram** ([Wikipedia](https://en.wikipedia.org/wiki/Spectrogram); FMP, p. 29, 55) shows the the intensity of frequencies over time. A spectrogram is simply the squared magnitude of the STFT:\n",
"\n",
"Instead, we compute a spectrum for small frames of the audio signal. The resulting sequence of spectra is called a [*spectrogram*](https://en.wikipedia.org/wiki/Spectrogram)."
"$$ S(m, \\omega) = \\left| X(m, \\omega) \\right|^2 $$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The human perception of sound intensity is logarithmic in nature. Therefore, we are often interested in the log amplitude:"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": true,
"slideshow": {
"slide_type": "subslide"
}
},
"outputs": [],
"source": [
"### `librosa.feature.melspectrogram`"
"S = abs(X)**2"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "notes"
}
},
"source": [
"To display any type of spectrogram in librosa, use [`librosa.display.specshow`](http://bmcfee.github.io/librosa/generated/librosa.display.specshow.html)."
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x10e0f3810>"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
},
{
"data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zbNI8G+znJm0opzvGbMBqPx7NuAwAAsEvNa5cnAABg\nCgQKAACgmUABAAA0EygAAIBmAgUAANBsXqeNBWBGSil3JnltkoNJLk/yhdWnfjnJuNb6oVm1DYCt\nZ9pYALZFKeWyJH9Qa71sxk0BYBu5QwHAVJRS3pcktdb3lVL+NMlvJbkqyZ8m+XCSf5zkJUl+otZ6\nXynl8iT/Mcnzs7Jy7T+qtT40i7YDcHbGUAAwCy9Kck+t9VVJzk/y12ut1yR5X1ZWqE2SjyZ5Z631\niiQ/neQ3ZtFQANbnDgUAs3LP6r9fTfLpNY+fW0q5MMlrkvxqKeVM/QtLKc+vtT4x3WYCsB6BAoCZ\nqLWeWlNc7D29L8mJWusPntlQSnlJku9Oo20AbJ4uTwDsOLXWp5J8qZTy5iQppbw+yR/OtlUATOIO\nBQA71d9O8qFSyjuTnEryN2utpiYE2GFMGwsAADTT5QkAAGgmUAAAAM0ECgAAoJlAAQAANBMoAACA\nZgIFAADQTKAAAACaCRQAAECz/wcS9nYb202fEAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10e094810>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"librosa.display.specshow(S, sr=sr, x_axis='time', y_axis='linear')"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Mel-spectrogram"
]
},
{
......@@ -152,6 +342,7 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true,
"slideshow": {
"slide_type": "subslide"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment