ludlows / PESQ

PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users (narrow band and wide band)
https://github.com/ludlows/PESQ
MIT License
533 stars 98 forks source link

ValueError: Buffer has wrong number of dimensions (expected 1, got 2) #44

Closed Tienyaul closed 1 year ago

Tienyaul commented 1 year ago

I got this Error, what should I do for it? Thx for helping or any way might solve it. image

ludlows commented 1 year ago

function pesq takes 1-D numpy arrays as the inputs.

Tienyaul commented 1 year ago

O~ Thanks for answer. So as next step, I need to transfer WAV file to be single track that get 1-D numpy arrays. Am I right? Or is there any easier way just read the audio file be 1-D numpy arrays?

I have working on this way now ref = wav1.sum(axis=1) / 2 deg = wav2.sum(axis=1) / 2

ludlows commented 1 year ago

Hi @Tienyaul ,

in the readme.md, we have an example showing you to load wav files in the numpy format.

from scipy.io import wavfile
from pesq import pesq

rate, ref = wavfile.read("./audio/speech.wav")
rate, deg = wavfile.read("./audio/speech_bab_0dB.wav")