diff --git a/README.md b/README.md index 828f7cd6..45e53b1e 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +# ViSQOL Modified + +This is a ViSQOL modified version that returns Audio Delay and its Sample Adjustments (In Seconds). To get a better understanding, ViSQOL algorithm aligns the two samples (reference and degraded) so they can be compared. First, it does a global alignment (Considered as the Audio Delay) which uses cross-correlation to find the best match, and then it does `Voice Activity Detection` to later do `Patch Alignment` (Considered as Audio Delay Sample Adjustment). For further explanation of the ViSQOL tool check [this arxiv paper](https://arxiv.org/pdf/2004.09584.pdf). The sample adjustement or patch alginment is important to understand how the audio behaves, not just the quality, but if there are speed up/slow down regions, this will translate into higher Sample Adjustments, and so the audio "experience" will be worse if these numbers are too high (This depends on the lenght of your audio file and the aims of the application to test - 7 second -> >~ 0.05) + +The original ViSQOL code is in [here](https://github.com/google/visqol) + # ViSQOL ViSQOL (Virtual Speech Quality Objective Listener) is an objective, full-reference metric for perceived audio quality. It uses a spectro-temporal measure of similarity between a reference and a test speech signal to produce a MOS-LQO (Mean Opinion Score - Listening Quality Objective) score. MOS-LQO scores range from 1 (the worst) to 5 (the best). diff --git a/src/alignment.cc b/src/alignment.cc index 388d2360..519bc9ee 100644 --- a/src/alignment.cc +++ b/src/alignment.cc @@ -11,6 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#include +using namespace std; #include "alignment.h" @@ -91,6 +93,13 @@ std::tuple Alignment::GloballyAlign( } AudioSignal new_degraded_signal{std::move(new_degraded_matrix), degraded_signal.sample_rate}; + static int myStaticVar; + if (myStaticVar == 0) { + myStaticVar = 1; + cout << "Audio Delay: " << (-1)*float(best_lag)/float(ref_signal.sample_rate) << " Seconds at " << ref_signal.sample_rate << "Hz\n"; + } else { + cout << "Audio Delay Sample Adjustment: " << (-1)*float(best_lag)/float(ref_signal.sample_rate) << " Seconds\n"; + } return std::make_tuple( new_degraded_signal, best_lag / static_cast(degraded_signal.sample_rate)); diff --git a/testdata/.DS_Store b/testdata/.DS_Store new file mode 100644 index 00000000..2977237b Binary files /dev/null and b/testdata/.DS_Store differ