forked from crmne/Genretron-Theano
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrack.py
28 lines (24 loc) · 914 Bytes
/
track.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from tables import *
import config
import utils
from spectrogram import Spectrogram
conf = config.get_config()
winsize = int(conf.get('Spectrogram', 'WindowSize'))
nframes = int(conf.get('Tracks', 'LengthInSeconds')) * \
int(conf.get('Tracks', 'SampleRate'))
stepsize = int(conf.get('Spectrogram', 'StepSize'))
fftres = int(conf.get('Spectrogram', 'FFTResolution'))
audio_folder = os.path.expanduser(conf.get('Input', 'AudioFolder'))
numberofgenres = len(utils.list_subdirs(audio_folder))
wins = Spectrogram.wins(winsize, nframes, stepsize)
bins = Spectrogram.bins(fftres)
shape = Spectrogram.shape(wins, bins)
class Track(IsDescription):
"""Description of a track in HDF5"""
idnumber = Int32Col()
name = StringCol(64)
path = StringCol(512)
genre = StringCol(32)
# target = BoolCol(shape=(numberofgenres,))
target = Int8Col()
spectrogram = Float32Col(dflt=0.0, shape=shape)