annotate experiment-reverb/code/segmentation.py @ 2:c87a9505f294
tip
Added LICENSE for code, removed .wav files
author |
Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk> |
date |
Sat, 30 Sep 2017 13:25:50 +0100 |
parents |
246d5546657c |
children |
|
rev |
line source |
e@0
|
1 #!/bin/env python2
|
e@0
|
2
|
e@0
|
3
|
e@0
|
4 print("Loading libraries")
|
e@0
|
5
|
e@0
|
6 from essentia.streaming import *
|
e@0
|
7 from os import listdir
|
e@0
|
8 from os.path import isdir, isfile
|
e@0
|
9
|
e@0
|
10 print("done")
|
e@0
|
11
|
e@0
|
12 songdirs = []
|
e@0
|
13
|
e@0
|
14 WINDOWSIZE = 1024
|
e@0
|
15 HOPSIZE = WINDOWSIZE/2
|
e@0
|
16
|
e@0
|
17 for fullsong in listdir('fullsongs'):
|
e@0
|
18 if isdir('fullsongs/%s' % fullsong):
|
e@0
|
19 print("%s is a directory, diving in." % fullsong)
|
e@0
|
20
|
e@0
|
21 for file in listdir('fullsongs/%s' % fullsong):
|
e@0
|
22 if isfile('fullsongs/%s/%s' % (fullsong, file)) and file[-3:].lower() == 'wav':
|
e@0
|
23
|
e@0
|
24 fullpath = "fullsongs/%s/%s" % (fullsong,file)
|
e@0
|
25 print(fullpath)
|
e@0
|
26
|
e@0
|
27 loader = MonoLoader(filename = fullpath)
|
e@0
|
28 frameCutter = FrameCutter(frameSize = WINDOWSIZE, hopSize = HOPSIZE)
|
e@0
|
29 windower = Windowing(size = WINDOWSIZE)
|
e@0
|
30
|
e@0
|
31 loader.audio >> frameCutter.signal
|
e@0
|
32 frameCutter.frame >> windower.frame
|
e@0
|
33 windower.frame >> None
|
e@0
|
34
|
e@0
|
35 essentia.run(loader)
|
e@0
|
36
|
e@0
|
37
|
e@0
|
38
|
e@0
|
39
|