* Change terminology: peak locking -> lamination (we no longer do peak locking)

* Adjustments to lamination code
This commit is contained in:
Chris Cannam
2008-07-08 16:32:52 +00:00
parent 55b9516fff
commit a96c85befc
3 changed files with 29 additions and 21 deletions

8
README
View File

@@ -19,10 +19,10 @@ Attractive features
* High quality results suitable for musical use * High quality results suitable for musical use
Rubber Band is a phase-vocoder-based frequency domain time Rubber Band is a phase-vocoder-based frequency domain time
stretcher with partial phase locking to peak frequencies and phase stretcher with phase resynchronisation at noisy transients and a
resynchronisation at noisy transients. It is suitable for most phase lamination technique to reduce phasiness. It is suitable for
musical uses with its default settings, and has a range of options most musical uses with its default settings, and has a range of
for fine tuning. options for fine tuning.
* Real-time capable * Real-time capable

View File

@@ -697,6 +697,8 @@ RubberBandStretcher::Impl::modifyChunk(size_t channel,
const int lookback = 1; const int lookback = 1;
double distacc = 0.0;
for (int i = count; i >= 0; i -= lookback) { for (int i = count; i >= 0; i -= lookback) {
bool resetThis = phaseReset; bool resetThis = phaseReset;
@@ -748,9 +750,11 @@ RubberBandStretcher::Impl::modifyChunk(size_t channel,
if (inherit) { if (inherit) {
double inherited = double inherited =
cd.unwrappedPhase[i + lookback] - cd.prevPhase[i + lookback]; cd.unwrappedPhase[i + lookback] - cd.prevPhase[i + lookback];
advance = ((advance * distance) + (inherited * (mi - distance))) advance = ((advance * distance) +
/ mi; (inherited * (maxdist - distance)))
/ maxdist;
outphase = p + advance; outphase = p + advance;
distacc += distance;
distance += 1.0; distance += 1.0;
} else { } else {
outphase = cd.unwrappedPhase[i] + advance; outphase = cd.unwrappedPhase[i] + advance;
@@ -770,6 +774,10 @@ RubberBandStretcher::Impl::modifyChunk(size_t channel,
cd.unwrappedPhase[i] = outphase; cd.unwrappedPhase[i] = outphase;
} }
if (m_debugLevel > 1) {
cerr << "mean inheritance distance = " << distacc / count << endl;
}
if (fullReset) unchanged = true; if (fullReset) unchanged = true;
cd.unchanged = unchanged; cd.unchanged = unchanged;

View File

@@ -72,7 +72,7 @@ int main(int argc, char **argv)
bool realtime = false; bool realtime = false;
bool precise = false; bool precise = false;
int threading = 0; int threading = 0;
bool peaklock = true; bool lamination = true;
bool longwin = false; bool longwin = false;
bool shortwin = false; bool shortwin = false;
bool hqpitch = false; bool hqpitch = false;
@@ -110,7 +110,7 @@ int main(int argc, char **argv)
{ "formant", 0, 0, 'F' }, { "formant", 0, 0, 'F' },
{ "no-threads", 0, 0, '0' }, { "no-threads", 0, 0, '0' },
{ "no-transients", 0, 0, '1' }, { "no-transients", 0, 0, '1' },
{ "no-peaklock", 0, 0, '2' }, { "no-lamination", 0, 0, '2' },
{ "window-long", 0, 0, '3' }, { "window-long", 0, 0, '3' },
{ "window-short", 0, 0, '4' }, { "window-short", 0, 0, '4' },
{ "bl-transients", 0, 0, '8' }, { "bl-transients", 0, 0, '8' },
@@ -138,7 +138,7 @@ int main(int argc, char **argv)
case '0': threading = 1; break; case '0': threading = 1; break;
case '@': threading = 2; break; case '@': threading = 2; break;
case '1': transients = NoTransients; crispchanged = true; break; case '1': transients = NoTransients; crispchanged = true; break;
case '2': peaklock = false; crispchanged = true; break; case '2': lamination = false; crispchanged = true; break;
case '3': longwin = true; crispchanged = true; break; case '3': longwin = true; crispchanged = true; break;
case '4': shortwin = true; crispchanged = true; break; case '4': shortwin = true; crispchanged = true; break;
case '8': transients = BandLimitedTransients; crispchanged = true; break; case '8': transients = BandLimitedTransients; crispchanged = true; break;
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
cerr << " --threads Assume multi-CPU even if only one CPU is identified" << endl; cerr << " --threads Assume multi-CPU even if only one CPU is identified" << endl;
cerr << " --no-transients Disable phase resynchronisation at transients" << endl; cerr << " --no-transients Disable phase resynchronisation at transients" << endl;
cerr << " --bl-transients Band-limit phase resync to extreme frequencies" << endl; cerr << " --bl-transients Band-limit phase resync to extreme frequencies" << endl;
cerr << " --no-peaklock Disable phase locking to peak frequencies" << endl; cerr << " --no-lamination Disable phase lamination" << endl;
cerr << " --window-long Use longer processing window (actual size may vary)" << endl; cerr << " --window-long Use longer processing window (actual size may vary)" << endl;
cerr << " --window-short Use shorter processing window" << endl; cerr << " --window-short Use shorter processing window" << endl;
cerr << " --pitch-hq In RT mode, use a slower, higher quality pitch shift" << endl; cerr << " --pitch-hq In RT mode, use a slower, higher quality pitch shift" << endl;
@@ -202,29 +202,29 @@ int main(int argc, char **argv)
cerr << " -h, --help Show this help" << endl; cerr << " -h, --help Show this help" << endl;
cerr << endl; cerr << endl;
cerr << "\"Crispness\" levels:" << endl; cerr << "\"Crispness\" levels:" << endl;
cerr << " -c 0 equivalent to --no-transients --no-peaklock --window-long" << endl; cerr << " -c 0 equivalent to --no-transients --no-lamination --window-long" << endl;
cerr << " -c 1 equivalent to --no-transients --no-peaklock" << endl; cerr << " -c 1 equivalent to --no-transients --no-lamination" << endl;
cerr << " -c 2 equivalent to --no-transients" << endl; cerr << " -c 2 equivalent to --no-transients" << endl;
cerr << " -c 3 equivalent to --bl-transients" << endl; cerr << " -c 3 equivalent to --bl-transients" << endl;
cerr << " -c 4 default processing options" << endl; cerr << " -c 4 default processing options" << endl;
cerr << " -c 5 equivalent to --no-peaklock --window-short (may be suitable for drums)" << endl; cerr << " -c 5 equivalent to --no-lamination --window-short (may be good for drums)" << endl;
cerr << endl; cerr << endl;
return 2; return 2;
} }
if (crispness >= 0 && crispchanged) { if (crispness >= 0 && crispchanged) {
cerr << "WARNING: Both crispness option and transients, peaklock or window options" << endl; cerr << "WARNING: Both crispness option and transients, lamination or window options" << endl;
cerr << " provided -- crispness will override these other options" << endl; cerr << " provided -- crispness will override these other options" << endl;
} }
switch (crispness) { switch (crispness) {
case -1: crispness = 4; break; case -1: crispness = 4; break;
case 0: transients = NoTransients; peaklock = false; longwin = true; shortwin = false; break; case 0: transients = NoTransients; lamination = false; longwin = true; shortwin = false; break;
case 1: transients = NoTransients; peaklock = false; longwin = false; shortwin = false; break; case 1: transients = NoTransients; lamination = false; longwin = false; shortwin = false; break;
case 2: transients = NoTransients; peaklock = true; longwin = false; shortwin = false; break; case 2: transients = NoTransients; lamination = true; longwin = false; shortwin = false; break;
case 3: transients = BandLimitedTransients; peaklock = true; longwin = false; shortwin = false; break; case 3: transients = BandLimitedTransients; lamination = true; longwin = false; shortwin = false; break;
case 4: transients = Transients; peaklock = true; longwin = false; shortwin = false; break; case 4: transients = Transients; lamination = true; longwin = false; shortwin = false; break;
case 5: transients = Transients; peaklock = false; longwin = false; shortwin = true; break; case 5: transients = Transients; lamination = false; longwin = false; shortwin = true; break;
}; };
if (!quiet) { if (!quiet) {
@@ -285,7 +285,7 @@ int main(int argc, char **argv)
RubberBandStretcher::Options options = 0; RubberBandStretcher::Options options = 0;
if (realtime) options |= RubberBandStretcher::OptionProcessRealTime; if (realtime) options |= RubberBandStretcher::OptionProcessRealTime;
if (precise) options |= RubberBandStretcher::OptionStretchPrecise; if (precise) options |= RubberBandStretcher::OptionStretchPrecise;
if (!peaklock) options |= RubberBandStretcher::OptionPhaseIndependent; if (!lamination) options |= RubberBandStretcher::OptionPhaseIndependent;
if (longwin) options |= RubberBandStretcher::OptionWindowLong; if (longwin) options |= RubberBandStretcher::OptionWindowLong;
if (shortwin) options |= RubberBandStretcher::OptionWindowShort; if (shortwin) options |= RubberBandStretcher::OptionWindowShort;
if (formant) options |= RubberBandStretcher::OptionFormantPreserved; if (formant) options |= RubberBandStretcher::OptionFormantPreserved;