Python 2.7.6 (default, Jan 10 2014, 13:35:22)
Type "copyright", "credits" or "license" for more information.
IPython 1.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
In [1]: from os import listdir
In [2]: from essentia.standard import AudioLoader
In [3]: cd ~/Desktop/Music
/Users/adj/Desktop/Music
In [4]: base_dir = '/Users/adj/Desktop/Music'
In [5]: music_list = listdir(base_dir)
In [6]: #The first item in music_list is not a music file, so it must be removed.
In [7]: music_list = music_list[1:]
In [8]: total_length = len(music_list)
In [9]: histogram_array = zeros(total_length)
In [10]: cntr = 0
...: for file in music_list:
...: loader = AudioLoader(filename = file)
...: audio, sr, nchnls = loader()
...: num_sec = audio.shape[0] / float(sr)
...: histogram_array[cntr] = num_sec
...: cntr += 1
...:
In [11]: #The previous calculation is very slow, so I am probably doing something inefficiently!
In [12]: bar(arange(total_length), histogram_array, 0.05)
Out[12]: <Container object of 194 artists>
In [13]: #My music collection on this computer is pretty small---sorry!