# HG changeset patch # User Chris Cannam # Date 1199985975 0 # Node ID 89a2b34a098f304e1a2a79088be905ed5f543dbb # Parent c3600d3cfe5c00746e9b1b392e821e0e6de6d174 * Adjust MFCC params in segmenter to match timbral MFCC params from Soundbite diff -r c3600d3cfe5c -r 89a2b34a098f dsp/segmentation/ClusterMeltSegmenter.cpp --- a/dsp/segmentation/ClusterMeltSegmenter.cpp Thu Jan 10 16:41:33 2008 +0000 +++ b/dsp/segmentation/ClusterMeltSegmenter.cpp Thu Jan 10 17:26:15 2008 +0000 @@ -76,14 +76,30 @@ } else if (featureType == FEATURE_TYPE_MFCC) { + // run internal processing at 22050 or thereabouts + int internalRate = 22050; + int decimationFactor = samplerate / internalRate; + if (decimationFactor < 1) decimationFactor = 1; + + // must be a power of two + while (decimationFactor & (decimationFactor - 1)) ++decimationFactor; + + if (decimationFactor > Decimator::getHighestSupportedFactor()) { + decimationFactor = Decimator::getHighestSupportedFactor(); + } + + if (decimationFactor > 1) { + decimator = new Decimator(getWindowsize(), decimationFactor); + } + MFCCConfig config; - config.FS = samplerate; - config.fftsize = 1024; - config.nceps = 20; - config.want_c0 = false; + config.FS = samplerate / decimationFactor; + config.fftsize = 2048; + config.nceps = 19; + config.want_c0 = true; mfcc = new MFCC(config); - ncoeff = config.nceps; + ncoeff = config.nceps + 1; } } @@ -235,6 +251,13 @@ const double *psource = samples; int pcount = nsamples; + if (decimator) { + pcount = nsamples / decimator->getFactor(); + double *decout = new double[pcount]; + decimator->process(samples, decout); + psource = decout; + } + int origin = 0; int frames = 0; @@ -272,6 +295,8 @@ cc[i] /= frames; } + if (decimator) delete[] psource; + features.push_back(cc); } diff -r c3600d3cfe5c -r 89a2b34a098f qm-dsp.pro --- a/qm-dsp.pro Thu Jan 10 16:41:33 2008 +0000 +++ b/qm-dsp.pro Thu Jan 10 17:26:15 2008 +0000 @@ -1,5 +1,5 @@ TEMPLATE = lib -CONFIG += warn_on staticlib release +CONFIG += warn_on staticlib debug CONFIG -= qt OBJECTS_DIR = tmp_obj MOC_DIR = tmp_moc