import numpy, scipy, matplotlib.pyplot as plt, librosa, urllib, IPython.display
Goals:
Download an audio file:
urllib.urlretrieve?
Load an audio file:
librosa.load?
Plot the spectrogram:
librosa.stft?
librosa.logamplitude?
librosa.display.specshow?
Use NMF to decompose the spectrogram:
librosa.decompose.decompose?
Plot the spectral profiles and temporal activations of each component individually:
plt.subplot?
Use the inverse STFT to synthesize the separated sources. (librosa.istft
expects a full, complex-valued spectrogram. Therefore, you will need to include the phase of the original spectrogram in your reconstruction. See the notebook on NMF for more details.)
librosa.istft?
Use the reconstructed outputs as inputs into the kick/snare classifier that you created in an earlier exercise. Observe the results; are you able to automatically classify the separated sources?
Use different audio files.
Alter the rank of the decomposition, n_components
. What happens when n_components
is too large? too small?
NMF is a useful preprocessor for MIR tasks such as music transcription. Using the steps above, build your own simple transcription system that returns a sequence of note events, [(onset time, class label, volume/gain)...]
.