I\'m trying to do a voice quality test (pesq), but I don\'t understand how to start. I trying to compile a public source code (http://www.itu.int/itu-t/recommendations/index.asp
In last versions of GCC, you may have to use this comamnd to compile:
gcc -o PESQ *.c -lm
BR
In addition to the answer from staticfloat
, and building on the answer from AntoineF, some gcc
version might throw the following warnings:
pesqmain.c: In function 'main':
pesqmain.c:322:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
printf ("An error of type %d ", Error_Flag);
^
pesqmain.c: In function 'pesq_measure':
pesqmain.c:629:35: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
fprintf (resultsFile, "%d\t", Fs);
^
pesqmain.c:636:34: warning: too many arguments for format [-Wformat-extra-args]
fprintf (resultsFile, "\n", Fs);
To solve the issue, you can ignore these warnings explicitly by running:
gcc -Wno-format -Wno-format-extra-args -o pesq *.c -lm # works on Ubuntu 16.04, gcc 5.4.0
Hope that can help some people not familiar with compiling C code like me!
Please, don't use PESQ / ITU-T P.862 anymore. It's superseded by P.863 (aka POLQA) for many good reasons.
For decades, people were using PESQ for applications it was not developed for (e.g., noise reduction, acoustic paths, etc.) - just because it was "available". For PESQ-WB, no one noticed for ~12 years that there was a bug in the implementation (wrong filter coefficients for input bandpass).
Note that even though the source code is available on ITU-T website for download, you need a commercial license to use it! The reference code at ITU-T is only there to re-generate reference results on your specific platform.
Finally: do not rely only on one single MOS metric for voice quality testing. Professionals should use a measurement system like the already mentioned ACQUA software or similar.
Try AQuA software, it's not an ITU-T standard, but solves VoIP speech quality testing very well:
http://www.sevana.fi/voice_quality_testing_measurement_analysis.php
You will need a C compiler (The ITU PESQ reference implementation is actually C, so you don't need a C++ compiler, although both should work just fine)
For instance, on linux, you would enter the source
directory and compile with gcc
:
$ cd Software/P862_annex_A_2005_CD/source
$ gcc -o PESQ *.c
This will compile the files dsp.c, pesqdsp.c, pesqio.c, pesqmain.c, pesqmod.c
into a binary file PESQ
which you can then run with ./PESQ
:
$ ./PESQ
Perceptual Evaluation of Speech Quality (PESQ)
Reference implementation for ITU-T Recommendations P.862, P.862.1 and P.862.2.
Version 2.0 October 2005.
<snip long unenlightening IP notice>
Usage:
PESQ HELP Displays this text
PESQ [options] ref deg
Run model on reference ref and degraded deg
Options: +8000 +16000 +swap +wb
Sample rate - No default. Must select either +8000 or +16000.
Swap byte order - machine native format by default. Select +swap for byteswap.
Default mode of operation is P.862 (narrowband handset listening). Select +wb
to use P.862.2 wideband extension (headphone listening).
File names may not begin with a + character.
Files with names ending .wav or .WAV are assumed to have a 44-byte header, which is automatically skipped. All other file types are assumed to have no header.
To run this binary and test your algorithm, you need the "reference" .wav file (This is the clean, original speech) and the "degraded" .wav file (This is the output of your algorithm). Simply pass both into PESQ
, and it will give you the output of the test. An example run on two .wav files included in the source distribution from the ITU:
$ cd Software/P862_annex_A_2005_CD/conform
$ ../source/PESQ +8000 or105.wav dg105.wav
Perceptual Evaluation of Speech Quality (PESQ)
Reference implementation for ITU-T Recommendations P.862, P.862.1 and P.862.2.
Version 2.0 October 2005.
<snip IP notice>
Reading reference file or105.wav...done.
Reading degraded file dg105.wav...done.
Level normalization...
IRS filtering...
Variable delay compensation...
Acoustic model processing...
P.862 Prediction (Raw MOS, MOS-LQO): = 2.237 1.844
Where the +8000
parameter denotes that the wav files are sampled at 8000Hz.