DEV Community

Cover image for ViSQOL: How to build and use on Windows
peterleif
peterleif

Posted on • Updated on

ViSQOL: How to build and use on Windows

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

  1. Install required (and recommended) software. Make sure you have only one Python version (version 3.9+) installed.
  2. Set BAZEL_VC environment variable to C:\Program Files\Microsoft Visual Studio\2022\Community\VC (change this if you installed Visual Studio in other directory or you installed a different version)
  3. 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
Enter fullscreen mode Exit fullscreen mode
  1. Set Windows to developer mode to allow the script to create symbolic links.
  2. Open "App execution aliases" settings and turn off aliases for Python as shown below.

App execution aliases Python settings

Build

  1. Clone the ViSQOL source code: git clone https://github.com/google/visqol.git
  2. In the source directory, execute bazel build :visqol -c opt.
  3. Execute bazel test all_unit_tests to perform unit tests.
  4. 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.
  5. 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

  1. Prepare reference signals and degraded signals in WAV format (48kHz, 16bit). Exact time alignment is not required.
  2. 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 put visqol.exe to the working directory).
  3. Execute visqol --reference_file [file path to the reference signal] --degraded_file [file path to the degraded signal] to get a single score.
  4. For batch execution, prepare a CSV file with the following format:
reference,degraded
ref1.wav,deg1.wav
ref2.wav,deg2.wav
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode

How to use ViSQOL for Speech

  1. Prepare reference signals and degraded signals in WAV format (16kHz, 16bit). Exact time alignment is not required.
  2. 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 put visqol.exe to the working directory).
  3. 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.
  4. For batch execution, prepare a CSV file with the following format:
reference,degraded
ref1.wav,deg1.wav
ref2.wav,deg2.wav
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
jasam_losha_ee3d18aa53718 profile image
JaSam Losha

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:

Image description