Mercurial > hg > sonic-annotator
changeset 116:1c0799754670
Normalise option (yet to be tested)
author | Chris Cannam |
---|---|
date | Fri, 03 Oct 2014 15:42:55 +0100 |
parents | 95de6db296a1 |
children | 5be4995f4029 |
files | .hgsubstate runner/FeatureExtractionManager.cpp runner/FeatureExtractionManager.h runner/main.cpp |
diffstat | 4 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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) {
--- 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<string> &summaryTypes, const Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries &boundaries); @@ -136,6 +137,7 @@ int m_defaultSampleRate; int m_sampleRate; int m_channels; + bool m_normalise; QMap<QString, AudioFileReader *> m_readyReaders;
--- 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<FeatureWriter *> writers; for (set<string>::const_iterator i = requestedWriterTags.begin();