# HG changeset patch # User Matthias Mauch # Date 1291212535 -32400 # Node ID 7af5312e66f86315fd1799dad2bd97c4461a2daa # Parent fc28c50caace920bf3a173f3780504050c19b64c new boost N parameter in chordino, chord dictionary loaded on initialisation (not construction) of plugin diff -r fc28c50caace -r 7af5312e66f8 Chordino.cpp --- a/Chordino.cpp Wed Dec 01 21:18:49 2010 +0900 +++ b/Chordino.cpp Wed Dec 01 23:08:55 2010 +0900 @@ -37,7 +37,6 @@ { if (debug_on) cerr << "--> Chordino" << endl; // get the *chord* dictionary from file (if the file exists) - m_chordnames = chordDictionary(&m_chorddict, &m_chordnotes); } @@ -146,21 +145,16 @@ d3.isQuantized = false; list.push_back(d3); - // ParameterDescriptor d4; - // d4.identifier = "chromanormalize"; - // d4.name = "chroma normalization"; - // d4.description = "How shall the chroma vector be normalized?"; - // d4.unit = ""; - // d4.minValue = 0; - // d4.maxValue = 3; - // d4.defaultValue = 0; - // d4.isQuantized = true; - // d4.valueNames.push_back("none"); - // d4.valueNames.push_back("maximum norm"); - // d4.valueNames.push_back("L1 norm"); - // d4.valueNames.push_back("L2 norm"); - // d4.quantizeStep = 1.0; - // list.push_back(d4); + ParameterDescriptor boostn; + boostn.identifier = "boostn"; + boostn.name = "boost N"; + boostn.description = "Relative weight of the N label."; + boostn.unit = ""; + boostn.minValue = 1.0; + boostn.maxValue = 2.0; + boostn.defaultValue = 1.0; + boostn.isQuantized = false; + list.push_back(boostn); return list; } @@ -236,7 +230,7 @@ if (!NNLSBase::initialise(channels, stepSize, blockSize)) { return false; } - + m_chordnames = chordDictionary(&m_chorddict, &m_chordnotes, m_boostN); return true; } @@ -260,8 +254,8 @@ Chordino::FeatureSet Chordino::getRemainingFeatures() { - cerr << hw[0] << hw[1] << endl; - if (debug_on) cerr << "--> getRemainingFeatures" << endl; + // cerr << hw[0] << hw[1] << endl; + if (debug_on) cerr << "--> getRemainingFeatures" << endl; FeatureSet fsOut; if (m_logSpectrum.size() == 0) return fsOut; int nChord = m_chordnames.size(); diff -r fc28c50caace -r 7af5312e66f8 NNLSBase.cpp --- a/NNLSBase.cpp Wed Dec 01 21:18:49 2010 +0900 +++ b/NNLSBase.cpp Wed Dec 01 23:08:55 2010 +0900 @@ -30,6 +30,7 @@ NNLSBase::NNLSBase(float inputSampleRate) : Plugin(inputSampleRate), + m_frameCount(0), m_logSpectrum(0), m_blockSize(0), m_stepSize(0), @@ -38,6 +39,8 @@ m_localTunings(0), m_whitening(1.0), m_preset(0.0), + m_useNNLS(1), + m_useHMM(1), m_localTuning(0), m_kernelValue(0), m_kernelFftIndex(0), @@ -46,9 +49,8 @@ m_tuneLocal(0), m_doNormalizeChroma(0), m_rollon(0), + m_boostN(1.1), m_s(0.7), - m_useNNLS(1), - m_useHMM(1), sinvalues(0), cosvalues(0) { @@ -238,6 +240,10 @@ return m_rollon; } + if (identifier == "boostn") { + return m_boostN; + } + if (identifier == "tuningmode") { if (m_tuneLocal) { return 1.0; @@ -280,6 +286,10 @@ m_useHMM = value; } + if (identifier == "boostn") { + m_boostN = value; + } + if (identifier == "tuningmode") { // m_tuneLocal = (value > 0) ? true : false; m_tuneLocal = value; diff -r fc28c50caace -r 7af5312e66f8 NNLSBase.h --- a/NNLSBase.h Wed Dec 01 21:18:49 2010 +0900 +++ b/NNLSBase.h Wed Dec 01 23:08:55 2010 +0900 @@ -64,7 +64,6 @@ vector m_localTunings; float m_whitening; float m_preset; - float m_s; float m_useNNLS; float m_useHMM; vector m_localTuning; @@ -75,6 +74,8 @@ bool m_tuneLocal; float m_doNormalizeChroma; float m_rollon; + float m_boostN; + float m_s; vector hw; vector sinvalues; vector cosvalues; diff -r fc28c50caace -r 7af5312e66f8 NNLSChroma.cpp --- a/NNLSChroma.cpp Wed Dec 01 21:18:49 2010 +0900 +++ b/NNLSChroma.cpp Wed Dec 01 23:08:55 2010 +0900 @@ -228,7 +228,7 @@ { float consonancepattern[24] = {0,-1,-1,1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1,1,-1,-1}; - for (int i = 0; i< 12; ++i) cerr << consonancepattern[i]<< endl; + // for (int i = 0; i< 12; ++i) cerr << consonancepattern[i]<< endl; if (debug_on) cerr << "--> getRemainingFeatures" << endl; FeatureSet fsOut; if (m_logSpectrum.size() == 0) return fsOut; diff -r fc28c50caace -r 7af5312e66f8 chromamethods.cpp --- a/chromamethods.cpp Wed Dec 01 21:18:49 2010 +0900 +++ b/chromamethods.cpp Wed Dec 01 23:08:55 2010 +0900 @@ -277,7 +277,7 @@ return path; } -vector chordDictionary(vector *mchorddict, vector > *m_chordnotes) { +vector chordDictionary(vector *mchorddict, vector > *m_chordnotes, float boostN) { typedef tokenizer > Tok; char_separator sep(",; ","="); @@ -304,7 +304,7 @@ iostreams::stream chordDictFile(chordDictFilename); string line; - int iElement = 0; + // int iElement = 0; int nChord = 0; vector loadedChordNames; @@ -368,10 +368,10 @@ loadedChordNames.push_back(os.str()); m_chordnotes->push_back(tempchordnotes); - for (int iNote = 0; iNote < tempchordnotes.size(); ++iNote) { - cerr << tempchordnotes[iNote] << " "; - } - cerr << endl; + // for (int iNote = 0; iNote < tempchordnotes.size(); ++iNote) { + // cerr << tempchordnotes[iNote] << " "; + // } + // cerr << endl; } } } @@ -382,8 +382,8 @@ vector tempchordvector; m_chordnotes->push_back(tempchordvector); float exponent = 2.0; - float boostN = 1.1; - + // float m_boostN = 1.1; + // cerr << " N BOOST : " << boostN << endl << endl; for (int iChord = 0; iChord < loadedChordDict.size()/24; iChord++) { float sum = 0; float stand = 0; diff -r fc28c50caace -r 7af5312e66f8 chromamethods.h --- a/chromamethods.h Wed Dec 01 21:18:49 2010 +0900 +++ b/chromamethods.h Wed Dec 01 23:08:55 2010 +0900 @@ -29,7 +29,7 @@ extern std::vector SpecialConvolution(std::vector convolvee, std::vector kernel); extern void dictionaryMatrix(float* dm, float s_param); -extern std::vector chordDictionary(std::vector *mchorddict, std::vector > *m_chordnotes); +extern std::vector chordDictionary(std::vector *mchorddict, std::vector > *m_chordnotes, float boostN); extern bool logFreqMatrix(int fs, int blocksize, float *outmatrix); static const char* notenames[24] = {