# HG changeset patch # User Chris Cannam # Date 1412347375 -3600 # Node ID 1c0799754670239514c3275b41d7f3c59059c59b # Parent 95de6db296a13153d1e48be7eedd006c4931e9a0 Normalise option (yet to be tested) diff -r 95de6db296a1 -r 1c0799754670 .hgsubstate --- a/.hgsubstate Fri Oct 03 15:07:19 2014 +0100 +++ b/.hgsubstate Fri Oct 03 15:42:55 2014 +0100 @@ -1,2 +1,2 @@ d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay -c9d456b1fcde4ddc6e0347c4eb105a8b6e4ca527 svcore +7a8f7a553b37bf8054cff054a4561271f897506e svcore diff -r 95de6db296a1 -r 1c0799754670 runner/FeatureExtractionManager.cpp --- a/runner/FeatureExtractionManager.cpp Fri Oct 03 15:07:19 2014 +0100 +++ b/runner/FeatureExtractionManager.cpp Fri Oct 03 15:42:55 2014 +0100 @@ -59,7 +59,8 @@ m_blockSize(16384), m_defaultSampleRate(0), m_sampleRate(0), - m_channels(0) + m_channels(0), + m_normalise(false) { } @@ -84,6 +85,11 @@ m_defaultSampleRate = sampleRate; } +void FeatureExtractionManager::setNormalise(bool normalise) +{ + m_normalise = normalise; +} + static PluginSummarisingAdapter::SummaryType getSummaryType(string name) { @@ -457,7 +463,8 @@ // (then close, and open again later with actual desired rate &c) AudioFileReader *reader = - AudioFileReaderFactory::createReader(source, 0, false, + AudioFileReaderFactory::createReader(source, 0, + m_normalise, &retrievalProgress); if (!reader) { @@ -556,8 +563,9 @@ ProgressPrinter retrievalProgress("Retrieving audio data..."); FileSource fs(source, &retrievalProgress); fs.waitForData(); - reader = AudioFileReaderFactory::createReader - (fs, m_sampleRate, false, &retrievalProgress); + reader = AudioFileReaderFactory::createReader(fs, m_sampleRate, + m_normalise, + &retrievalProgress); retrievalProgress.done(); } if (!reader) { diff -r 95de6db296a1 -r 1c0799754670 runner/FeatureExtractionManager.h --- a/runner/FeatureExtractionManager.h Fri Oct 03 15:07:19 2014 +0100 +++ b/runner/FeatureExtractionManager.h Fri Oct 03 15:42:55 2014 +0100 @@ -43,6 +43,7 @@ void setChannels(int channels); void setDefaultSampleRate(int sampleRate); + void setNormalise(bool normalise); bool setSummaryTypes(const set &summaryTypes, const Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries &boundaries); @@ -136,6 +137,7 @@ int m_defaultSampleRate; int m_sampleRate; int m_channels; + bool m_normalise; QMap m_readyReaders; diff -r 95de6db296a1 -r 1c0799754670 runner/main.cpp --- a/runner/main.cpp Fri Oct 03 15:07:19 2014 +0100 +++ b/runner/main.cpp Fri Oct 03 15:42:55 2014 +0100 @@ -245,6 +245,8 @@ cerr << " for all supported audio files and take all of those as" << endl; cerr << " input instead." << endl; cerr << endl; + cerr << " -n, --normalise Normalise input audio files to signal absolute max = 1.f." << endl; + cerr << endl; cerr << " -f, --force Continue with subsequent files following an error." << endl; cerr << endl; cerr << "Housekeeping options:" << endl; @@ -394,6 +396,7 @@ bool force = false; bool multiplex = false; bool recursive = false; + bool normalise = false; bool list = false; bool summaryOnly = false; QString skeletonFor = ""; @@ -521,6 +524,9 @@ } else if (arg == "-r" || arg == "--recursive") { recursive = true; continue; + } else if (arg == "-n" || arg == "--normalise") { + normalise = true; + continue; } else if (arg == "-f" || arg == "--force") { force = true; continue; @@ -607,6 +613,8 @@ FeatureExtractionManager manager; + manager.setNormalise(normalise); + if (!requestedSummaryTypes.empty()) { if (!manager.setSummaryTypes(requestedSummaryTypes, boundaries)) { @@ -617,7 +625,7 @@ } manager.setSummariesOnly(summaryOnly); - + vector writers; for (set::const_iterator i = requestedWriterTags.begin();