Connect up the ChannelsTogether option in R3 as well, to extend the channel lock range upward

This commit is contained in:
Chris Cannam
2022-07-04 10:52:50 +01:00
parent 67cb55c375
commit 687e3958a7
3 changed files with 33 additions and 18 deletions

View File

@@ -331,25 +331,30 @@ public:
* the others in the case where the pitch scale is exactly 1.0. * the others in the case where the pitch scale is exactly 1.0.
* *
* 11. Flags prefixed \c OptionChannels control the method used * 11. Flags prefixed \c OptionChannels control the method used
* for processing two-channel audio in the R2 engine. These * for processing two-channel stereo audio. These have different,
* options have no effect when using the R3 engine. These options * but related, effects in the R2 and R3 engines. These options
* may not be changed after construction. * may not be changed after construction.
* *
* \li \c OptionChannelsApart - Each channel is processed * \li \c OptionChannelsApart - Channels are handled for maximum
* individually, though timing is synchronised and phases are * individual fidelity, with less tight synchronisation. In the
* synchronised at transients (depending on the OptionTransients * R3 engine, this means stereo synchronisation is maintained
* setting). This gives the highest quality for the individual * more closely for lower-frequency content than higher. In R2,
* channels but a relative lack of stereo focus and unrealistic * it means the stereo channels are processed individually and
* increase in "width". This is the default. * only synchronised at transients. In both engines this gives
* the highest quality for the individual channels but a more
* diffuse stereo image and an unnatural increase in "width".
* This option is the default.
* *
* \li \c OptionChannelsTogether - The first two channels (where * \li \c OptionChannelsTogether - Channels are handled for
* two or more are present) are considered to be a stereo pair * tighter synchronisation at the expense of individual
* and are processed in mid-side format; mid and side are * fidelity. In the R3 engine, this means stereo synchronisation
* processed individually, with timing synchronised and phases * is maintained more closely for the full frequency range. In
* synchronised at transients (depending on the OptionTransients * R2, it means the first two channels are considered to be a
* setting). This usually leads to better focus in the centre * stereo pair and are processed in mid-side format, with mid
* but a loss of stereo space and width. Any channels beyond * and side processed as if they were separate channels before
* the first two are processed individually. * being recombined. This usually leads to better focus in the
* centre but relatively less stereo space and width and lower
* fidelity for individual channel content.
* *
* Finally, flags prefixed \c OptionStretch are obsolete flags * Finally, flags prefixed \c OptionStretch are obsolete flags
* provided for backward compatibility only. They are ignored by * provided for backward compatibility only. They are ignored by

View File

@@ -156,6 +156,7 @@ public:
double meanMagnitude, double meanMagnitude,
int unityCount, int unityCount,
bool realtime, bool realtime,
bool tighterChannelLock,
Guidance &guidance) const { Guidance &guidance) const {
bool hadPhaseReset = guidance.phaseReset.present; bool hadPhaseReset = guidance.phaseReset.present;
@@ -191,7 +192,12 @@ public:
guidance.channelLock.present = true; guidance.channelLock.present = true;
guidance.channelLock.f0 = 0.0; guidance.channelLock.f0 = 0.0;
guidance.channelLock.f1 = 600.0;
if (tighterChannelLock) {
guidance.channelLock.f1 = nyquist;
} else {
guidance.channelLock.f1 = 600.0;
}
bool kick = bool kick =
(segmentation.percussiveBelow > 40.0) && (segmentation.percussiveBelow > 40.0) &&

View File

@@ -968,7 +968,10 @@ R3Stretcher::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop)
} else { } else {
m_unityCount = 0; m_unityCount = 0;
} }
bool tighterChannelLock =
m_parameters.options & RubberBandStretcher::OptionChannelsTogether;
m_guide.updateGuidance(ratio, m_guide.updateGuidance(ratio,
prevOuthop, prevOuthop,
classifyScale->mag.data(), classifyScale->mag.data(),
@@ -980,6 +983,7 @@ R3Stretcher::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop)
v_mean(classifyScale->mag.data() + 1, classify/2), v_mean(classifyScale->mag.data() + 1, classify/2),
m_unityCount, m_unityCount,
isRealTime(), isRealTime(),
tighterChannelLock,
cd->guidance); cd->guidance);
/* /*
if (c == 0) { if (c == 0) {