コード例 #1
0
ファイル: main.py プロジェクト: scopatz/umdone
def remove_umms(ns):
    if ns.output is None:
        ns.output = '{0}-umdone{1}'.format(*os.path.splitext(ns.input))
    x, sr = librosa.load(ns.input, mono=True, sr=None)
    bounds = segment.boundaries(x, sr, window_length=ns.window_length, 
                                threshold=ns.noise_threshold)
    mfccs, distances, categories = umdone.io.load(ns.train)
    matches = discover.match(x, sr, bounds, mfccs, distances, categories) 
    del x, sr, bounds, mfccs, distances, categories
    # read back in to preserve mono/stereo and levels on output
    x, sr = librosa.load(ns.input, mono=False, sr=None)
    y = segment.remove_slices(x.T, matches)
    librosa.output.write_wav(ns.output, y.T, sr, norm=False)
コード例 #2
0
def remove_umms(ns):
    if ns.output is None:
        ns.output = '{0}-umdone{1}'.format(*os.path.splitext(ns.input))
    x, sr = librosa.load(ns.input, mono=True, sr=None)
    bounds = segment.boundaries(x,
                                sr,
                                window_length=ns.window_length,
                                threshold=ns.noise_threshold)
    mfccs, distances, categories = umdone.io.load(ns.train)
    matches = discover.match(x, sr, bounds, mfccs, distances, categories)
    del x, sr, bounds, mfccs, distances, categories
    # read back in to preserve mono/stereo and levels on output
    x, sr = librosa.load(ns.input, mono=False, sr=None)
    y = segment.remove_slices(x.T, matches)
    librosa.output.write_wav(ns.output, y.T, sr, norm=False)
コード例 #3
0
ファイル: trainer.py プロジェクト: scopatz/umdone
    def __init__(self, fname, window_length=0.05, threshold=0.01, n_mfcc=13):
        # settings
        self.filename = fname
        self.window_length = window_length
        self.threshold = threshold
        self.n_mfcc = n_mfcc

        # data
        self.current_segment = 0
        self.raw, self.sr = librosa.load(fname, mono=True, sr=None)
        self.bounds = segment.boundaries(self.raw, self.sr, window_length=window_length, 
                                         threshold=threshold)
        self.nsegments = len(self.bounds)
        self.runtime = len(self.raw) / self.sr

        # results, keyed by current segement
        self.categories = {}
コード例 #4
0
    def __init__(self, fname, window_length=0.05, threshold=0.01, n_mfcc=13):
        # settings
        self.filename = fname
        self.window_length = window_length
        self.threshold = threshold
        self.n_mfcc = n_mfcc

        # data
        self.current_segment = 0
        self.raw, self.sr = librosa.load(fname, mono=True, sr=None)
        self.bounds = segment.boundaries(self.raw,
                                         self.sr,
                                         window_length=window_length,
                                         threshold=threshold)
        self.nsegments = len(self.bounds)
        self.runtime = len(self.raw) / self.sr

        # results, keyed by current segement
        self.categories = {}