def extract_features(wavfilename, fctr=400, fsd=1.0, type=1):
    """Computes beat-synchronous chroma features from the given wave file

    Calls Dan Ellis' chrombeatftrs Matlab function.
    """
    x, fs = mlab.wavread(wavfilename, nout=2)
    feats, beats = mlab.chrombeatftrs(x, fs, fctr, fsd, type, nout=2)
    return feats, beats.flatten()
Esempio n. 2
0
def extract_features(wavfilename, fctr=400, fsd=1.0, type=1):
    """Computes beat-synchronous chroma features from the given wave file

    Calls Dan Ellis' chrombeatftrs Matlab function.
    """
    x, fs = mlab.wavread(wavfilename, nout=2)
    feats, beats = mlab.chrombeatftrs(x, fs, fctr, fsd, type, nout=2)
    return feats, beats.flatten()
Esempio n. 3
0
def extract_features(wavfilename, fctr=400, fsd=1.0, type=1):
    """Computes beat-synchronous chroma features from the given wave file

    Calls Dan Ellis' chrombeatftrs Matlab function.
    """
    logger.info('Extracting beat-synchronous chroma features from %s',
                wavfilename)
    x,fs = mlab.wavread(wavfilename, nout=2)
    feats,beats = mlab.chrombeatftrs(x.mean(1)[:,np.newaxis], fs, fctr, fsd,
                                     type, nout=2)
    songlen = x.shape[0] / fs
    return feats, beats.flatten(), songlen
Esempio n. 4
0
def extract_features(wavfilename, fctr=400, fsd=1.0, type=1):
    """Computes beat-synchronous chroma features from the given wave file

    Calls Dan Ellis' chrombeatftrs Matlab function.
    """
    logger.info('Extracting beat-synchronous chroma features from %s',
                wavfilename)
    x, fs = mlab.wavread(wavfilename, nout=2)
    feats, beats = mlab.chrombeatftrs(x.mean(1)[:, np.newaxis],
                                      fs,
                                      fctr,
                                      fsd,
                                      type,
                                      nout=2)
    songlen = x.shape[0] / fs
    return feats, beats.flatten(), songlen
def extract_features(wavfilename, fctr=400, fsd=1.0, type=1):
    """Computes beat-synchronous chroma features from the given wave file

    Calls Dan Ellis' chrombeatftrs Matlab function.
    """
    if lower(wavfilename[-4:]) == '.csv':
        logger.info('CSV filename reading preprocessed features from %s',
                    wavfilename)
        csvr = csv.reader(open(wavfilename, 'rb'), delimiter=',')
        feats = np.array([[float(x) for x in row] for row in csvr])
        beats = np.arange(len(feats)) * 0.0058   # simple fake frame locations
        songlen = len(feats) * 0.0058
    else:
        logger.info('Extracting beat-synchronous chroma features from %s',
                    wavfilename)
        x,fs = mlab.wavread(wavfilename, nout=2)
        feats,beats = mlab.chrombeatftrs(x.mean(1)[:,np.newaxis], fs, fctr, fsd,
                                         type, nout=2)
        songlen = x.shape[0] / fs
    return feats, beats.flatten(), songlen