International Audio Laboratories Erlangen
Authors: Meinard Müller, Frank Zalkow
References:
[Mueller2015] Meinard Müller. Fundamentals of Music Processing. Springer Verlag, 2015.
Install Python 3.6 Miniconda (https://conda.io/miniconda.html) with default settings. Then open an Anaconda-aware command line interface (e.g. Anaconda Command Prompt in Windows, standard Terminal in Linux/OS X).
Step into the directory containing the provided files environment.yml
and install.ipynb
and create a Python environment (named MIRCourse
) for this course. You may confirm on demand. Also note it could take a awhile.
cd MIRCourse/
conda env create -f environment.yml
If you are on Windows, activate your environment with the following command:
activate MIRCourse
If you are on Linux or OS X, activate your environment with the collowing command:
source activate MIRCourse
Now run the following command to start Jupyter.
jupyter notebook
Your default browser should open and show the current directory. If it does not, open your browser and go to http://localhost:8888. There you can open a notebook by clicking on its file name.
Your browser should display the same file you viewed as an HTML file before. However, this time it is an interactive Jupyter notebook. If everything is installed correctly, you should be able to execute the following cells. For executing a cell, first click on it and then click this button in the menue above: . As a shortcut for executing a cell one may also use SHIFT+ENTER (⇧+⏎). (In some circumstances it can take a while if matplotlib is used for the first time.)
import numpy as np
from scipy import signal
from matplotlib import pyplot as plt
from IPython.display import Audio
%matplotlib inline
fs = 4000
t = np.linspace(0, 1, fs + 1)
Play Audio:
chirp = signal.chirp(t, 220, 0.8, 440)
Audio(chirp, rate=fs)
Display the spectogram:
winsize = 256
spec, freqs, t, img = plt.specgram(chirp, Fs=fs, NFFT=winsize, noverlap=winsize//2, mode='magnitude', scale='dB')
plt.ylim([0, 660])
plt.xlabel('Time (seconds)')
plt.ylabel('Frequency (Hertz)')
plt.colorbar()
If everything worked correctly, you got a player for audio playback and you see an image of the spectogram.
Acknowledgment: The International Audio Laboratories Erlangen are a joint institution of the Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU) and Fraunhofer Institute for Integrated Circuits IIS.