NMF Example

In [105]:
# import some libraries
import urllib
import scipy,sklearn
import librosa
import IPython.display
import matplotlib.pyplot as plt
import numpy
%matplotlib nbagg

Load the first file

In [91]:
filename = 'conga_groove.wav'
urllib.urlretrieve('http://audio.musicinformationretrieval.com/' + filename,
                  filename=filename)
Out[91]:
('conga_groove.wav', <httplib.HTTPMessage instance at 0x7f20fc78ccb0>)
In [92]:
x, fs = librosa.load(filename)
In [93]:
IPython.display.Audio(x,rate=fs)
Out[93]:

Load the second file

In [94]:
filename2 = '1_bar_funk_groove.mp3'
urllib.urlretrieve('http://audio.musicinformationretrieval.com/' + filename2,
                  filename=filename2)
Out[94]:
('1_bar_funk_groove.mp3', <httplib.HTTPMessage instance at 0x7f20e6813368>)
In [95]:
x2, fs = librosa.load(filename2)
x2 = x2[0:(4*len(x))]
x2[0] = 1
In [96]:
IPython.display.Audio(x2,rate=fs)
Out[96]: