What is 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).
As the above citation from the ViSQOL README explains, ViSQOL is an objective metric for how good people feels the audio quality. There are many metrics for the similar purpose such as PESQ and POLQA, but the best point of ViSQOL is that it is an open source software and we can use it for free.
However, ViSQOL is mainly intended for using on Linux environment, and building it on Windows is not straightforward. As of now (Oct 2023), Windows build is "Experimental, last tested on Windows 10 x64, 2020 August" (ViSQOL README), and there is no official binary release for Windows. As far as I know, there is no article that explains in detail how to build ViSQOL on Windows. This is why I wrote this both for my personal memo and for anyone who wants to use ViSQOL on Windows.
Software required for building ViSQOL (V3.3.3)
Required softwares
- Bazel 5.4.0 (I also tried Bazel 6.1.0, but it failed to run unit tests)
- Python 3.9+ (I checked with 3.11 that is installed using the installer)
- Visual Studio 2022 (probably 2019 is OK)
The point here is that you do NOT need MSYS2 to build ViSQOL.
However, you CANNOT use venv (or similar virtual environment for Python), as Bazel somehow fails to detect the right Python executables.
In addition, I had to remove all other Python installations to run the Bazel build script without errors.
Recommended softwares
- Git (for fetching the source code)
- Scoop (for installing Git and Bazel)
Using Scoop, Bazel installation is easy: scoop install bazel@5.4.0
.
Preparation
- Install required (and recommended) software. Make sure you have only one Python version (version 3.9+) installed.
- Set
BAZEL_VC
environment variable toC:\Program Files\Microsoft Visual Studio\2022\Community\VC
(change this if you installed Visual Studio in other directory or you installed a different version) - Execute the following to install the packages required to build TensorFlow
pip3 install -U six numpy wheel packaging
pip3 install -U keras_preprocessing --no-deps
- Set Windows to developer mode to allow the script to create symbolic links.
- Open "App execution aliases" settings and turn off aliases for Python as shown below.
Build
- Clone the ViSQOL source code:
git clone https://github.com/google/visqol.git
- In the source directory, execute
bazel build :visqol -c opt
. - Execute
bazel test all_unit_tests
to perform unit tests. - Copy visqol.exe from the build directory (
bazel-out\x64_windows-opt\bin
). No other file in the build directory is required for running ViSQOL. - Copy "model" directory from the visqol source directory. You need to put it in the current directory when executing
visqol.exe
.
How to use ViSQOL for Audio
- Prepare reference signals and degraded signals in WAV format (48kHz, 16bit). Exact time alignment is not required.
- Put
visqol.exe
and "model" directory from the ViSQOL source directory in a working directory (or you can set PATH environment variable so you do not need to putvisqol.exe
to the working directory). - Execute
visqol --reference_file [file path to the reference signal] --degraded_file [file path to the degraded signal]
to get a single score. - For batch execution, prepare a CSV file with the following format:
reference,degraded
ref1.wav,deg1.wav
ref2.wav,deg2.wav
- Execute
visqol --batch_input_csv [file path to the CSV file] --results_csv [file path to the output CSV]
to get a CSV file with the result for the batch execution:
reference,degraded,moslqo
ref1.wav,deg1.wav,3.4
ref2.wav,deg2.wav,4.1
How to use ViSQOL for Speech
- Prepare reference signals and degraded signals in WAV format (16kHz, 16bit). Exact time alignment is not required.
- Put
visqol.exe
and "model" directory from the ViSQOL source directory in a working directory (or you can set PATH environment variable so you do not need to putvisqol.exe
to the working directory). - Execute
visqol --use_speech_mode --reference_file [file path to the reference signal] --degraded_file [file path to the degraded signal]
to get a single score. - For batch execution, prepare a CSV file with the following format:
reference,degraded
ref1.wav,deg1.wav
ref2.wav,deg2.wav
- Execute
visqol --use_speech_mode --batch_input_csv [file path to the CSV file] --results_csv [file path to the output CSV]
to get a CSV file with the result for the batch execution:
reference,degraded,moslqo
ref1.wav,deg1.wav,3.4
ref2.wav,deg2.wav,4.1
Top comments (1)
Brother I need your help... I followed every step of your article and when I run bazel build :visqol -c opt inside the root directory I get a huge list of compilements with the final message being Build did NOT complete succesfully, please help brother: