# v_pesq2mos

## PURPOSE

V_PESQ2MOS convert PESQ speech quality scores to MOS m=(p)

## SYNOPSIS

function m=v_pesq2mos(p)

## DESCRIPTION

    V_PESQ2MOS convert PESQ speech quality scores to MOS m=(p)
    Inputs:    p  is a matrix of PESQ scores

    Outputs:   m  is a matrix, the same size as p, of MOS scores

     The PESQ measure is defined in [2]. The mapping function, defined in [3],
     converts raw PESQ scores (which lie in the range -0.5 to 4.5) onto the
     MOS-LQO (Mean Opinion Score - Listening Quality Objective [2]) scale in the
     range 1 to 5. The MOS scale is defined in [1] as
               5=Excellent, 4=Good, 3=Fair, 2=Poor, 1=Bad.

     Refs: [1]    ITU-T. Methods for subjective determination of transmission quality.
               Recommendation P.800, Aug. 1996.
           [2]    ITU-T. Mean opinion score (MOS) terminology.
               Recommendation P.800.1, July 2006.
           [2]    ITU-T. Perceptual evaluation of speech quality (PESQ), an objective
               method for end-to-end speech quality assessment of narrowband telephone
               networks and speech codecs. Recommendation P.862, Feb. 2001.
           [3]    ITU-T. Mapping function for transforming P.862 raw result scores to MOS-LQO.
               Recommendation P.862.1, Nov. 2003.

## CROSS-REFERENCE INFORMATION

This function calls:

- v_pesq2mos V_PESQ2MOS convert PESQ speech quality scores to MOS m=(p)

This function is called by:

- v_mos2pesq V_MOS2PESQ convert MOS speech quality scores to PESQ p=(m)
- v_pesq2mos V_PESQ2MOS convert PESQ speech quality scores to MOS m=(p)

## SOURCE CODE

    0001 function m=v_pesq2mos(p)
    0002 %V_PESQ2MOS convert PESQ speech quality scores to MOS m=(p)
    0003 %Inputs:    p  is a matrix of PESQ scores
    0004 %
    0005 %Outputs:   m  is a matrix, the same size as p, of MOS scores
    0006 %
    0007 % The PESQ measure is defined in [2]. The mapping function, defined in [3],
    0008 % converts raw PESQ scores (which lie in the range -0.5 to 4.5) onto the
    0009 % MOS-LQO (Mean Opinion Score - Listening Quality Objective [2]) scale in the
    0010 % range 1 to 5. The MOS scale is defined in [1] as
    0011 %           5=Excellent, 4=Good, 3=Fair, 2=Poor, 1=Bad.
    0012 %
    0013 % Refs: [1]    ITU-T. Methods for subjective determination of transmission quality.
    0014 %           Recommendation P.800, Aug. 1996.
    0015 %       [2]    ITU-T. Mean opinion score (MOS) terminology.
    0016 %           Recommendation P.800.1, July 2006.
    0017 %       [2]    ITU-T. Perceptual evaluation of speech quality (PESQ), an objective
    0018 %           method for end-to-end speech quality assessment of narrowband telephone
    0019 %           networks and speech codecs. Recommendation P.862, Feb. 2001.
    0020 %       [3]    ITU-T. Mapping function for transforming P.862 raw result scores to MOS-LQO.
    0021 %           Recommendation P.862.1, Nov. 2003.
    0022
    0023 %      Copyright (C) Mike Brookes 2012-2013
    0024 %      Version: $Id: v_pesq2mos.m 10865 2018-09-21 17:22:45Z dmb $
    0025 %
    0026 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0027 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0028 %
    0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0030 %   This program is free software; you can redistribute it and/or modify
    0031 %   it under the terms of the GNU Lesser General Public License as published by
    0032 %   the Free Software Foundation; either version 3 of the License, or
    0033 %   (at your option) any later version.
    0034 %
    0035 %   This program is distributed in the hope that it will be useful,
    0036 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0037 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0038 %   GNU Lesser General Public License for more details.
    0039 %
    0040 %   You can obtain a copy of the GNU Lesser General Public License from
    0041 %   https://www.gnu.org/licenses/ .
    0042 %
    0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0044 persistent a b c d
    0045 if isempty(a)
    0046     a=0.999;
    0047     b=4.999-a;
    0048     c=-1.4945;
    0049     d=4.6607;
    0050 end
    0051 if nargout>0
    0052     m=a+b./(1+exp(c*p+d));
    0053 else
    0054     if nargin<1 || isempty(p)
    0055         pp=linspace(-0.5,4.5,100);
    0056     else
    0057         pp=p;
    0058     end
    0059     plot(pp,v_pesq2mos(pp));
    0060     xlabel('PESQ (P.862)');
    0061     ylabel('Mean Opimion Score (MOS)');
    0062 end