pyAudioAnalysis icon indicating copy to clipboard operation
pyAudioAnalysis copied to clipboard

ValueError: cannot reshape array of size 4800 into shape (240,10)

Open scut-salmon opened this issue 6 years ago • 5 comments

Hello, The code didn't work when I using F = audioFeatureExtraction.stFeatureExtraction(x, Fs, 0.050Fs, 0.025Fs); which says Traceback (most recent call last): File "", line 1, in File "pyAudioAnalysis/audioFeatureExtraction.py", line 577, in stFeatureExtraction curFV[2] = stEnergyEntropy(x) # short-term entropy of energy File "pyAudioAnalysis/audioFeatureExtraction.py", line 51, in stEnergyEntropy subWindows = frame.reshape(subWinLength, numOfShortBlocks, order='F').copy() ValueError: cannot reshape array of size 4800 into shape (240,10)

Could you give me any suggestion to solve it? Thanks for your time.

scut-salmon avatar Mar 30 '18 06:03 scut-salmon

The code works when I use F = audioFeatureExtraction.stFeatureExtraction(x[:, 0], Fs, 0.050Fs, 0.025Fs)

It seems that the audio with two channels is not work. What should I do, any examples for this kind of audio?

Thanks

scut-salmon avatar Mar 30 '18 08:03 scut-salmon

These functions are designed for single channel audio signals. I am not sure if extracting a feature for multiple channels does even exist. You can merge the audio first, by for example averaging the channels or extract the features for each channel. It depends on the meaning of the channels. That is if they are captured by multiple microphones for example.

pvanlaar avatar Jun 06 '18 14:06 pvanlaar

Yup. Apparently taking the mean of the two channels works. @scut-salmon

Pipe-Runner avatar Sep 27 '18 07:09 Pipe-Runner

you can use two channels .wav file

zhengqun avatar Nov 20 '18 06:11 zhengqun

audioBasicIO.stereo_to_mono(signal) does the averaging. See https://github.com/tyiannak/pyAudioAnalysis/blob/master/pyAudioAnalysis/MidTermFeatures.py#L328-L329

burak43 avatar Jul 22 '20 19:07 burak43