Some (temporary) debug etc

This commit is contained in:
Chris Cannam
2022-06-09 14:16:49 +01:00
parent 022bb6d40c
commit 70a7b6d688
3 changed files with 48 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ public:
BinSegmenter(Parameters parameters) :
m_parameters(parameters),
m_numeric(m_parameters.binCount, 0),
m_classFilter(16)
m_classFilter(15)
{
}
@@ -70,7 +70,19 @@ public:
m_numeric[i] = 2; break;
}
}
MovingMedian<int>::filter(m_classFilter, m_numeric.data(), m_numeric.size());
MovingMedian<int>::filter(m_classFilter, m_numeric);
/*
std::cout << "c:";
for (int i = 0; i < n; ++i) {
if (i > 0) std::cout << ",";
if (m_numeric[i] == 1) {
std::cout << "1";
} else {
std::cout << "0";
}
}
std::cout << std::endl;
*/
double f0 = 0.0;
for (int i = 1; i < n; ++i) {
if (m_numeric[i] != 1) {

View File

@@ -653,6 +653,30 @@ R3StretcherImpl::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop)
cd->segmentation = cd->nextSegmentation;
cd->nextSegmentation = cd->segmenter->segment(cd->nextClassification.data());
/*
if (c == 0) {
double pb = cd->nextSegmentation.percussiveBelow;
double pa = cd->nextSegmentation.percussiveAbove;
double ra = cd->nextSegmentation.residualAbove;
int pbb = binForFrequency(pb, classify);
int pab = binForFrequency(pa, classify);
int rab = binForFrequency(ra, classify);
std::cout << "pb = " << pb << ", pbb = " << pbb << std::endl;
std::cout << "pa = " << pa << ", pab = " << pab << std::endl;
std::cout << "ra = " << ra << ", rab = " << rab << std::endl;
std::cout << "s:";
for (int i = 0; i <= classify/2; ++i) {
if (i > 0) std::cout << ",";
if (i < pbb || (i >= pab && i <= rab)) {
std::cout << "1";
} else {
std::cout << "0";
}
}
std::cout << std::endl;
}
*/
m_troughPicker.findNearestAndNextPeaks
(classifyScale->mag.data(), 3, nullptr,
classifyScale->troughs.data());

View File

@@ -283,6 +283,16 @@ protected:
static void logCout(const std::string &message) {
std::cout << "RubberBandStretcher: " << message << std::endl;
}
//!!! dupes
int binForFrequency(double f, int fftSize) const {
return int(round(f * double(fftSize) /
m_parameters.sampleRate));
}
double frequencyForBin(int b, int fftSize) const {
return (double(b) * m_parameters.sampleRate)
/ double(fftSize);
}
};
}