Example #1
0
File: io.py Project: scopatz/umdone
def _save_new(fname, mfccs, flat_mfccs, categories, distances, lengths):
    if distances is None:
        distances = dtw.distance_matrix(mfccs)
    with tb.open_file(fname, 'a') as f:
        f.create_earray('/', 'categories', shape=(0,), obj=categories)
        f.create_earray('/', 'mfcc_lengths', shape=(0,), obj=lengths)
        f.create_earray('/', 'mfccs', shape=(0, flat_mfccs.shape[1]), obj=flat_mfccs)
        f.create_array('/', 'distances', obj=distances)  # not extendable!
Example #2
0
File: io.py Project: scopatz/umdone
def _save_append(fname, mfccs, flat_mfccs, categories, distances, lengths):
    if distances is None:
        mfccs = _load_mfccs(fname) + mfccs
        distances = dtw.distance_matrix(mfccs)
    with tb.open_file(fname, 'a') as f:
        f.root.categories.append(categories)
        f.root.mfcc_lengths.append(lengths)
        f.root.mfccs.append(flat_mfccs)
        f.remove_node('/', 'distances')
        f.create_array('/', 'distances', obj=distances)  # not extendable!
Example #3
0
File: io.py Project: 111t8e/umdone
def _save_append(fname, mfccs, flat_mfccs, categories, distances, lengths):
    if distances is None:
        mfccs = _load_mfccs(fname) + mfccs
        distances = dtw.distance_matrix(mfccs)
    with tb.open_file(fname, 'a') as f:
        f.root.categories.append(categories)
        f.root.mfcc_lengths.append(lengths)
        f.root.mfccs.append(flat_mfccs)
        f.remove_node('/', 'distances')
        f.create_array('/', 'distances', obj=distances)  # not extendable!
Example #4
0
File: io.py Project: 111t8e/umdone
def _save_new(fname, mfccs, flat_mfccs, categories, distances, lengths):
    if distances is None:
        distances = dtw.distance_matrix(mfccs)
    with tb.open_file(fname, 'a') as f:
        f.create_earray('/', 'categories', shape=(0, ), obj=categories)
        f.create_earray('/', 'mfcc_lengths', shape=(0, ), obj=lengths)
        f.create_earray('/',
                        'mfccs',
                        shape=(0, flat_mfccs.shape[1]),
                        obj=flat_mfccs)
        f.create_array('/', 'distances', obj=distances)  # not extendable!
Example #5
0
 def compute_distances(self, outfile, callback=None):
     mfccs = self.mfccs
     if os.path.isfile(outfile):
         mfccs = umdone.io._load_mfccs(outfile) + mfccs
     self.distances = dtw.distance_matrix(mfccs, callback=callback)
     return self.distances
Example #6
0
 def compute_distances(self, outfile, callback=None):
     mfccs = self.mfccs
     if os.path.isfile(outfile):
         mfccs = umdone.io._load_mfccs(outfile) + mfccs
     self.distances = dtw.distance_matrix(mfccs, callback=callback)
     return self.distances