vbaicai / python-pesq Goto Github PK
View Code? Open in Web Editor NEWA python package for calculating the PESQ.
License: MIT License
A python package for calculating the PESQ.
License: MIT License
with python 3.10, I use the example script:
import soundfile as sf
from pypesq import pesq
ref, sr = sf.read("ref.wav")
deg, sr = sf.read("deg.wav")
score = pesq(ref, deg, sr)
print(score)
and get the error
Traceback (most recent call last):
File "/home/lattepanda/Documents/pesq3.py", line 7, in <module>
score = pesq(ref, deg, sr)
File "/home/lattepanda/.local/lib/python3.10/site-packages/pypesq/__init__.py", line 21, in pesq
max_sample = np.max(np.abs(np.array([ref, deg])))
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
info about both files:
sox --i ref.wav
Input File : 'ref.wav'
Channels : 1
Sample Rate : 8000
Precision : 16-bit
Duration : 00:00:51.03 = 408226 samples ~ 3827.12 CDDA sectors
File Size : 816k
Bit Rate : 128k
Sample Encoding: 16-bit Signed Integer PCM
sox --i deg.wav
Input File : 'deg.wav'
Channels : 2
Sample Rate : 8000
Precision : 16-bit
Duration : 00:00:50.54 = 404301 samples ~ 3790.32 CDDA sectors
File Size : 1.62M
Bit Rate : 256k
Sample Encoding: 16-bit Signed Integer PCM
Hello everyone,
If I do not have a clean version of speech .
Can I compute the PESQ between the noisy original speech and the enhanced speech?
what does that mean ?
Best Regards.
s
When trying to install pypesq via pip, I get the following error:
(noisered) username@username:~$ pip install pypesq
Collecting pypesq
Using cached pypesq-1.2.4.tar.gz (30 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./anaconda3/envs/noisered/lib/python3.9/site-packages (from pypesq) (1.23.5)
Building wheels for collected packages: pypesq
Building wheel for pypesq (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [94 lines of output]
running bdist_wheel
running build
running build_py
file numpy.py (for module numpy) not found
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/pypesq
copying pypesq/init.py -> build/lib.linux-x86_64-cpython-39/pypesq
file numpy.py (for module numpy) not found
running build_ext
building 'pesq_core' extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/pypesq
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/dsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/dsp.o
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesq.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o
In file included from /home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1948,
from /home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from pypesq/pesq.c:2:
/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
pypesq/pesq.c: In function ‘_pesq’:
pypesq/pesq.c:61:34: warning: passing argument 1 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
61 | float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
| ~~~^~~~~~
| |
| char *
In file included from pypesq/pesq.c:5:
pypesq/pesq.h:287:28: note: expected ‘short int *’ but argument is of type ‘char *’
287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
| ~~~~~~~~^~~
pypesq/pesq.c:61:45: warning: passing argument 2 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
61 | float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
| ~~~^~~~~~
| |
| char *
In file included from pypesq/pesq.c:5:
pypesq/pesq.h:287:41: note: expected ‘short int *’ but argument is of type ‘char *’
287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
| ~~~~~~~~^~~
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqdsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqio.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o
pypesq/pesqio.c: In function ‘load_src’:
pypesq/pesqio.c:200:10: warning: unused variable ‘s’ [-Wunused-variable]
200 | char s;
| ^
pypesq/pesqio.c:198:10: warning: unused variable ‘count’ [-Wunused-variable]
198 | long count;
| ^~~~~
pypesq/pesqio.c:196:10: warning: unused variable ‘to_read’ [-Wunused-variable]
196 | long to_read;
| ^~~~~~~
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmain.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o
pypesq/pesqmain.c: In function ‘compute_pesq’:
pypesq/pesqmain.c:118:10: warning: unused variable ‘names’ [-Wunused-variable]
118 | int names = 0;
| ^~~~~
pypesq/pesqmain.c: In function ‘pesq_measure’:
pypesq/pesqmain.c:405:25: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
405 | long start, end;
| ^~~
pypesq/pesqmain.c:405:18: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
405 | long start, end;
| ^~~~~
pypesq/pesqmain.c:242:9: warning: unused variable ‘i’ [-Wunused-variable]
242 | int i;
| ^
pypesq/pesqmain.c:404:12: warning: ‘resultsFile’ may be used uninitialized [-Wmaybe-uninitialized]
404 | if (resultsFile != NULL) {
| ^
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmod.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o
pypesq/pesqmod.c: In function ‘utterance_split’:
pypesq/pesqmod.c:298:10: warning: variable ‘Utt_Delay’ set but not used [-Wunused-but-set-variable]
298 | long Utt_Delay;
| ^~~~~~~~~
pypesq/pesqmod.c: In function ‘pesq_psychoacoustic_model’:
pypesq/pesqmod.c:806:13: warning: variable ‘peak’ set but not used [-Wunused-but-set-variable]
806 | float peak;
| ^~~~
pypesq/pesqmod.c:782:24: warning: variable ‘power_deg’ set but not used [-Wunused-but-set-variable]
782 | float power_ref, power_deg;
| ^~~~~~~~~
pypesq/pesqmod.c:782:13: warning: variable ‘power_ref’ set but not used [-Wunused-but-set-variable]
782 | float power_ref, power_deg;
| ^~~~~~~~~
g++ -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -shared -Wl,-rpath,/home/username/anaconda3/envs/noisered/lib -Wl,-rpath-link,/home/username/anaconda3/envs/noisered/lib -L/home/username/anaconda3/envs/noisered/lib -L/home/username/anaconda3/envs/noisered/lib -Wl,-rpath,/home/username/anaconda3/envs/noisered/lib -Wl,-rpath-link,/home/username/anaconda3/envs/noisered/lib -L/home/username/anaconda3/envs/noisered/lib build/temp.linux-x86_64-cpython-39/pypesq/dsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o -o build/lib.linux-x86_64-cpython-39/pesq_core.cpython-39-x86_64-linux-gnu.so
/home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o:(.bss+0x10): multiple definition of Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here /home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o:(.bss+0x0): multiple definition of
Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here
/home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o:(.bss+0x10): multiple definition of Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here /home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o:(.bss+0x60): multiple definition of
Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here
/home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o:(.bss+0x40): multiple definition of `InIIR_Nsos'; build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
error: command '/usr/bin/g++' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pypesq
Running setup.py clean for pypesq
Failed to build pypesq
Installing collected packages: pypesq
Running setup.py install for pypesq ... error
error: subprocess-exited-with-error
× Running setup.py install for pypesq did not run successfully.
│ exit code: 1
╰─> [96 lines of output]
running install
/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
file numpy.py (for module numpy) not found
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/pypesq
copying pypesq/init.py -> build/lib.linux-x86_64-cpython-39/pypesq
file numpy.py (for module numpy) not found
running build_ext
building 'pesq_core' extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/pypesq
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/dsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/dsp.o
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesq.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o
In file included from /home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1948,
from /home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from pypesq/pesq.c:2:
/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
pypesq/pesq.c: In function ‘_pesq’:
pypesq/pesq.c:61:34: warning: passing argument 1 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
61 | float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
| ~~~^~~~~~
| |
| char *
In file included from pypesq/pesq.c:5:
pypesq/pesq.h:287:28: note: expected ‘short int *’ but argument is of type ‘char *’
287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
| ~~~~~~~~^~~
pypesq/pesq.c:61:45: warning: passing argument 2 of ‘compute_pesq’ from incompatible pointer type [-Wincompatible-pointer-types]
61 | float pesq = compute_pesq(ref->data, deg->data, ref->dimensions[0], deg->dimensions[0], fs);
| ~~~^~~~~~
| |
| char *
In file included from pypesq/pesq.c:5:
pypesq/pesq.h:287:41: note: expected ‘short int *’ but argument is of type ‘char *’
287 | float compute_pesq(short * ref, short * deg, long ref_n_samples, long deg_n_samples, long fs);
| ~~~~~~~~^~~
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqdsp.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqio.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o
pypesq/pesqio.c: In function ‘load_src’:
pypesq/pesqio.c:200:10: warning: unused variable ‘s’ [-Wunused-variable]
200 | char s;
| ^
pypesq/pesqio.c:198:10: warning: unused variable ‘count’ [-Wunused-variable]
198 | long count;
| ^~~~~
pypesq/pesqio.c:196:10: warning: unused variable ‘to_read’ [-Wunused-variable]
196 | long to_read;
| ^~~~~~~
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmain.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o
pypesq/pesqmain.c: In function ‘compute_pesq’:
pypesq/pesqmain.c:118:10: warning: unused variable ‘names’ [-Wunused-variable]
118 | int names = 0;
| ^~~~~
pypesq/pesqmain.c: In function ‘pesq_measure’:
pypesq/pesqmain.c:405:25: warning: variable ‘end’ set but not used [-Wunused-but-set-variable]
405 | long start, end;
| ^~~
pypesq/pesqmain.c:405:18: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
405 | long start, end;
| ^~~~~
pypesq/pesqmain.c:242:9: warning: unused variable ‘i’ [-Wunused-variable]
242 | int i;
| ^
pypesq/pesqmain.c:404:12: warning: ‘resultsFile’ may be used uninitialized [-Wmaybe-uninitialized]
404 | if (resultsFile != NULL) {
| ^
gcc -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -I/home/username/anaconda3/envs/noisered/include -fPIC -O2 -isystem /home/username/anaconda3/envs/noisered/include -fPIC -Ipypesq -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include/numpy -I/home/username/anaconda3/envs/noisered/include/python3.9 -I/home/username/anaconda3/envs/noisered/lib/python3.9/site-packages/numpy/core/include -c pypesq/pesqmod.c -o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o
pypesq/pesqmod.c: In function ‘utterance_split’:
pypesq/pesqmod.c:298:10: warning: variable ‘Utt_Delay’ set but not used [-Wunused-but-set-variable]
298 | long Utt_Delay;
| ^~~~~~~~~
pypesq/pesqmod.c: In function ‘pesq_psychoacoustic_model’:
pypesq/pesqmod.c:806:13: warning: variable ‘peak’ set but not used [-Wunused-but-set-variable]
806 | float peak;
| ^~~~
pypesq/pesqmod.c:782:24: warning: variable ‘power_deg’ set but not used [-Wunused-but-set-variable]
782 | float power_ref, power_deg;
| ^~~~~~~~~
pypesq/pesqmod.c:782:13: warning: variable ‘power_ref’ set but not used [-Wunused-but-set-variable]
782 | float power_ref, power_deg;
| ^~~~~~~~~
g++ -pthread -B /home/username/anaconda3/envs/noisered/compiler_compat -shared -Wl,-rpath,/home/username/anaconda3/envs/noisered/lib -Wl,-rpath-link,/home/username/anaconda3/envs/noisered/lib -L/home/username/anaconda3/envs/noisered/lib -L/home/username/anaconda3/envs/noisered/lib -Wl,-rpath,/home/username/anaconda3/envs/noisered/lib -Wl,-rpath-link,/home/username/anaconda3/envs/noisered/lib -L/home/username/anaconda3/envs/noisered/lib build/temp.linux-x86_64-cpython-39/pypesq/dsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesq.o build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o -o build/lib.linux-x86_64-cpython-39/pesq_core.cpython-39-x86_64-linux-gnu.so
/home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o:(.bss+0x10): multiple definition of Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here /home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqio.o:(.bss+0x0): multiple definition of
Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here
/home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqmain.o:(.bss+0x10): multiple definition of Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here /home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o:(.bss+0x60): multiple definition of
Nb'; build/temp.linux-x86_64-cpython-39/pypesq/pesq.o:(.bss+0x0): first defined here
/home/username/anaconda3/envs/noisered/compiler_compat/ld: build/temp.linux-x86_64-cpython-39/pypesq/pesqmod.o:(.bss+0x40): multiple definition of `InIIR_Nsos'; build/temp.linux-x86_64-cpython-39/pypesq/pesqdsp.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
error: command '/usr/bin/g++' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pypesq
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
(noisered) username@username:$ conda activate speech_enhance$ pip install pesq
(speech_enhance) username@username:
Collecting pesq
Using cached pesq-0.0.4-cp36-cp36m-linux_x86_64.whl
Installing collected packages: pesq
Successfully installed pesq-0.0.4
This error happens even when I install it on new environments without anything else installed. What can I do to solve this? I'm using Ubuntu 22.04.
Hi Jingdong Li:
this is my code :
ref, _ = librosa.load(fliepath_ref,sr=sr,mono=True)
deg, _ = librosa.load(fliepath_deg,sr=sr,mono=True)
pesq(ref,deg)
thanks
Thanks for the useful code.
When I try to run command "python setup.py", there is an error. What is the right command for running setup.py?
Another question is about missing pesq_core module when running init.py. Does this problem fixed after I run setup.py correctly?
Thanks for your help
I am trying to install pesq on a PC running Windows 11.
Running "pip install pesq" I get the error:
Requirements should be satisfied by a PEP 517 installer.
If you are using pip, you can try `pip install --use-pep517`.
So then I try "pip install --use-pep517 pesq" and I get this:
Collecting pesq
Using cached pesq-0.0.4.tar.gz (38 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pesq
Building wheel for pesq (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pesq (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-39
creating build\lib.win-amd64-cpython-39\pesq
copying pesq\_pesq.py -> build\lib.win-amd64-cpython-39\pesq
copying pesq\__init__.py -> build\lib.win-amd64-cpython-39\pesq
copying pesq\cypesq.pyx -> build\lib.win-amd64-cpython-39\pesq
copying pesq\dsp.h -> build\lib.win-amd64-cpython-39\pesq
copying pesq\pesq.h -> build\lib.win-amd64-cpython-39\pesq
copying pesq\pesqio.h -> build\lib.win-amd64-cpython-39\pesq
copying pesq\pesqmain.h -> build\lib.win-amd64-cpython-39\pesq
copying pesq\pesqpar.h -> build\lib.win-amd64-cpython-39\pesq
copying pesq\dsp.c -> build\lib.win-amd64-cpython-39\pesq
copying pesq\pesqdsp.c -> build\lib.win-amd64-cpython-39\pesq
copying pesq\pesqmod.c -> build\lib.win-amd64-cpython-39\pesq
running build_ext
C:\Users\Austin\AppData\Local\Temp\pip-build-env-whdgjz6a\normal\Lib\site-packages\Cython\Compiler\Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: C:\Users\Austin\AppData\Local\Temp\pip-install-iq5n64re\pesq_8874ba0989db4092a1645ce59a04cf75\pesq\cypesq.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Compiling pesq/cypesq.pyx because it changed.
[1/1] Cythonizing pesq/cypesq.pyx
building 'cypesq' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pesq
Failed to build pesq
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pesq)
Note: I already have Visual Studio 2022 with Build Tools installed.
a,sr=sf.read('E:/speech/sliced_test_clean/S_01_01.wav')
b,sr=sf.read('E:/speech/sliced_test_-5/S_01_01.wav')
score=pesq(a,b,sr)
print(score)
there is no print
both ref and deg have non-zero values, fs = 16000, but pesq(ref, deg, fs) raises "Processing error"
As a suggestion Apache 2 or MIT
Hi everyone.
I am asking about the meaning of nan PESQ score.
After some successful compute of PESQ score for my speech samples I got the following error for the residual samples
anaconda3/lib/python3.6/site-packages/pypesq-1.0-py3.6-linux-x86_64.egg/pypesq/init.py:16: RuntimeWarning: invalid value encountered in true_divide
deg = 0.999*deg/np.max(np.abs(deg))
Thank you.
Hi,I failed to install python-pesq on windows neither python3 nor python2.Does python-pesq not support windows?
Thanks for the wonderful code. In your example, I guess it is for .wav file. But for the audio in .raw, is this function still valid? And what is the correct reading function for .raw file.
Thanks for your help.
first of all, i'm very glad to found this project and thanks for you contribution.
but my envirment is python 2.7 and i found you project is depending on python 3+.
so how do i make it apply to python 2.7?
// this may be supported to python 3+, because when i run 'python setup.py install' and i got some errors :
pypesq/pesq.c(21) : error C2079: 'pesqmodule' uses undefined struct 'PyModuleDef'
pypesq/pesq.c(22) : error C2065: 'PyModuleDef_HEAD_INIT' : undeclared identifier
pypesq/pesq.c(22) : error C2099: initializer is not a constant
pypesq/pesq.c(23) : warning C4047: 'initializing' : 'int' differs in levels of indirection from 'char [10]'
pypesq/pesq.c(24) : error C2078: too many initializers
pypesq/pesq.c(31) : warning C4013: 'PyModule_Create' undefined; assuming extern returning int
pypesq/pesq.c(31) : warning C4098: 'PyInit_pesq_core' : 'void' function returning a value
pypesq/pesq.c(54) : error C2143: syntax error : missing ';' before 'type'
pypesq/pesq.c(59) : error C2065: 'pesq' : undeclared identifier
pypesq/pesq.c(60) : error C2065: 'pesq' : undeclared identifier
i found it at:
static struct PyModuleDef pesqmodule = {
PyModuleDef_HEAD_INIT,
"pesq_core",
module_docstring,
-1,
module_methods
};
this package is really useful for the community. Have you considered uploading it to pypi?
Hope for some one's help. Thank you!
Code:
from pydub import AudioSegment
from pypesq import pesq
sound1 = AudioSegment.from_file('D:/Test/speech.wav', 'wav')
sound2 = AudioSegment.from_file('D:/Test/speech_bab_0dB.wav', 'wav')
score = pesq(sound1, sound2, 16000)
print(score)
Error:
ValueError Traceback (most recent call last)
----> 5 score = pesq(sound1, sound2, 16000)
---> 21 max_sample = np.max(np.abs(np.array([ref, deg])))
ValueError: could not broadcast input array from shape (3100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1) into shape (3100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
why not have pypesq.whl
When installing, I get:
In file included from /Users/shamoon/Library/Python/3.7/lib/python/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830:
/Users/shamoon/Library/Python/3.7/lib/python/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
^
pypesq/pesq.c:5:10: fatal error: 'pesq.h' file not found
#include "pesq.h"
^~~~~~~~
1 warning and 1 error generated.
error: command 'clang' failed with exit status 1
Running setup.py install for pypesq ... error
Not sure why that's happening, because pesq.h
is clearly there. Any help?
Hi vBaiCai! thanks a lot for sharing this. I have been trying to implement PESQ. I was wondering from the code:
from pypesq import pesq
ref, sr = sf.read(...)
deg, sr = sf.read(...)
what exactly is suppose to be the input to sf.read.
Thank you in advance!
I tested this code with the audio files from
https://github.com/ludlows/python-pesq
(i.e. speech.wav
vs speech_bab_0dB.wav
)
and got the score 1.9688572883605957
.
There was said, the score should be 1.0832337141036987
for wide band pesq and 1.6072081327438354
for narrow band pesq.
Looking at the examples in
https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/47333/versions/3/previews/test_pesq2_mtlb.m/index.html
there are 3 values that can be calculated:
% NB PESQ MOS = 1.969
% NB MOS LQO = 1.607
% WB MOS LQO = 1.083
I would expect to get the MOS LQO
without downsampling.
Is it intended to always return the NB PESQ MOS
?
If yes, do you have a reason for that?
if (err_info->Nutterances < 1)
{
/*printf ("Processing error!\n");*/
/*exit (1);*/
PyErr_SetString(PyExc_RuntimeError, "processing error!");
}
Log print warnings.warn('Processing Error! return NaN........')
use older version, i see it stop at conditions err_info->Nutterances < 1 processing error! WHY?
but if i change metric="pesq" to metric="" ,training is ok!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.