* bandlimited transient reset -- needs testing & refinement
This commit is contained in:
@@ -34,8 +34,9 @@ public:
|
||||
static const int OptionStretchElastic = 0x00000000;
|
||||
static const int OptionStretchPrecise = 0x00000010;
|
||||
|
||||
static const int OptionTransientsCrisp = 0x00000000;
|
||||
static const int OptionTransientsMixed = 0x00000000;
|
||||
static const int OptionTransientsSmooth = 0x00000100;
|
||||
static const int OptionTransientsCrisp = 0x00000200;
|
||||
|
||||
static const int OptionPhasePeakLocked = 0x00000000;
|
||||
static const int OptionPhaseIndependent = 0x00001000;
|
||||
|
||||
@@ -604,6 +604,7 @@ RubberBandStretcher::Impl::getLatency() const
|
||||
void
|
||||
RubberBandStretcher::Impl::setTransientsOption(Options options)
|
||||
{
|
||||
//!!!
|
||||
if (options & OptionTransientsSmooth) {
|
||||
m_options |= OptionTransientsSmooth;
|
||||
} else {
|
||||
|
||||
@@ -568,13 +568,17 @@ RubberBandStretcher::Impl::modifyChunk(size_t channel, size_t outputIncrement,
|
||||
}
|
||||
|
||||
bool lockThis = lock;
|
||||
/*!!!
|
||||
|
||||
if (!(m_options & OptionTransientsSmooth) &&
|
||||
!(m_options & OptionTransientsCrisp)) {
|
||||
// must be OptionTransientsMixed
|
||||
size_t low = lrint((150 * m_blockSize) / rate);
|
||||
size_t high = lrint((1000 * m_blockSize) / rate);
|
||||
if (lockThis) {
|
||||
if (i > low && i < high) lockThis = false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (!lockThis) {
|
||||
|
||||
if (i == 0 || p != pp) {
|
||||
|
||||
33
src/main.cpp
33
src/main.cpp
@@ -36,13 +36,18 @@ int main(int argc, char **argv)
|
||||
bool realtime = false;
|
||||
bool precise = false;
|
||||
bool threaded = true;
|
||||
bool transients = true;
|
||||
bool peaklock = true;
|
||||
bool longwin = false;
|
||||
bool shortwin = false;
|
||||
int crispness = -1;
|
||||
bool help = false;
|
||||
|
||||
enum {
|
||||
NoTransients,
|
||||
BandLimitedTransients,
|
||||
Transients
|
||||
} transients = Transients;
|
||||
|
||||
float fthresh0 = -1.f;
|
||||
float fthresh1 = -1.f;
|
||||
float fthresh2 = -1.f;
|
||||
@@ -70,6 +75,7 @@ int main(int argc, char **argv)
|
||||
{ "thresh0", 1, 0, '5' },
|
||||
{ "thresh1", 1, 0, '6' },
|
||||
{ "thresh2", 1, 0, '7' },
|
||||
{ "bl-transients", 0, 0, '8' },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -86,13 +92,14 @@ int main(int argc, char **argv)
|
||||
case 'R': realtime = true; break;
|
||||
case 'P': precise = true; break;
|
||||
case '0': threaded = false; break;
|
||||
case '1': transients = false; break;
|
||||
case '1': transients = NoTransients; break;
|
||||
case '2': peaklock = false; break;
|
||||
case '3': longwin = true; break;
|
||||
case '4': shortwin = true; break;
|
||||
case '5': fthresh0 = atof(optarg); break;
|
||||
case '6': fthresh1 = atof(optarg); break;
|
||||
case '7': fthresh2 = atof(optarg); break;
|
||||
case '8': transients = BandLimitedTransients; break;
|
||||
case 'c': crispness = atoi(optarg); break;
|
||||
default: break;
|
||||
}
|
||||
@@ -146,10 +153,10 @@ int main(int argc, char **argv)
|
||||
|
||||
switch (crispness) {
|
||||
case -1: crispness = 2; break;
|
||||
case 0: transients = false; peaklock = false; longwin = false; shortwin = false; break;
|
||||
case 1: transients = true; peaklock = false; longwin = false; shortwin = false; break;
|
||||
case 2: transients = true; peaklock = true; longwin = false; shortwin = false; break;
|
||||
case 3: transients = true; peaklock = false; longwin = false; shortwin = true; break;
|
||||
case 0: transients = NoTransients; peaklock = false; longwin = false; shortwin = false; break;
|
||||
case 1: transients = Transients; peaklock = false; longwin = false; shortwin = false; break;
|
||||
case 2: transients = Transients; peaklock = true; longwin = false; shortwin = false; break;
|
||||
case 3: transients = Transients; peaklock = false; longwin = false; shortwin = true; break;
|
||||
};
|
||||
|
||||
char *fileName = strdup(argv[optind++]);
|
||||
@@ -188,12 +195,24 @@ int main(int argc, char **argv)
|
||||
RubberBandStretcher::Options options = 0;
|
||||
if (realtime) options |= RubberBandStretcher::OptionProcessRealTime;
|
||||
if (precise) options |= RubberBandStretcher::OptionStretchPrecise;
|
||||
if (!transients) options |= RubberBandStretcher::OptionTransientsSmooth;
|
||||
// if (!transients) options |= RubberBandStretcher::OptionTransientsSmooth;
|
||||
if (!peaklock) options |= RubberBandStretcher::OptionPhaseIndependent;
|
||||
if (!threaded) options |= RubberBandStretcher::OptionThreadingNone;
|
||||
if (longwin) options |= RubberBandStretcher::OptionWindowLong;
|
||||
if (shortwin) options |= RubberBandStretcher::OptionWindowShort;
|
||||
|
||||
switch (transients) {
|
||||
case NoTransients:
|
||||
options |= RubberBandStretcher::OptionTransientsSmooth;
|
||||
break;
|
||||
case BandLimitedTransients:
|
||||
options |= RubberBandStretcher::OptionTransientsMixed;
|
||||
break;
|
||||
case Transients:
|
||||
options |= RubberBandStretcher::OptionTransientsCrisp;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pitchshift != 1.0) {
|
||||
frequencyshift *= pow(2.0, pitchshift / 12);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user