gpt4 book ai didi

python - pyAudioAnalysis 库错误 : cannot reshape array of size 4400 into shape (220, 10)

转载 作者:太空宇宙 更新时间:2023-11-03 15:06:21 32 4
gpt4 key购买 nike

我正在尝试提取 wav 文件的一些特征,我有这个:

https://s3-us-west-2.amazonaws.com/music-emotions/ambient/13+Clock+in+the+Morning+-+Waiters+the++Free+Music+Archive+(No+Copyright+Music).wav

我正在使用 pyAudioAnalysis 库的特征提取工具:

https://github.com/tyiannak/pyAudioAnalysis/wiki/3.-Feature-Extraction

问题是我收到 numpy 的 reshape() 函数的错误。我遵循 wiki 中如何使用特征提取器的指南,如下所示:

[Fs, x] = audioBasicIO.readAudioFile('13 Clock in the Morning - Waiters the  Free Music Archive (No Copyright Music).wav')
F = audioFeatureExtraction.stFeatureExtraction(x, Fs, 0.050 * Fs, 0.025 * Fs)

这是我得到的错误:

      1 [Fs, x] = audioBasicIO.readAudioFile("song-wavs/"+song.name)
----> 2 F = audioFeatureExtraction.stFeatureExtraction(x, Fs, 0.050 * Fs, 0.025 * Fs)

pyAudioAnalysis/audioFeatureExtraction.pyc in stFeatureExtraction(signal, Fs, Win, Step)
575 curFV[0] = stZCR(x) # zero crossing rate
576 curFV[1] = stEnergy(x) # short-term energy
--> 577 curFV[2] = stEnergyEntropy(x) # short-term entropy of energy
578 [curFV[3], curFV[4]] = stSpectralCentroidAndSpread(X, Fs) # spectral centroid and spread
579 curFV[5] = stSpectralEntropy(X) # spectral entropy

pyAudioAnalysis/audioFeatureExtraction.pyc in stEnergyEntropy(frame, numOfShortBlocks)
49 frame = frame[0:subWinLength * numOfShortBlocks]
50 # subWindows is of size [numOfShortBlocks x L]
---> 51 subWindows = frame.reshape(subWinLength, numOfShortBlocks, order='F').copy()
52
53 # Compute normalized sub-frame energies:

ValueError: cannot reshape array of size 4400 into shape (220,10)

谁能告诉我如何解决 reshape 问题以及我做错了什么?

最佳答案

我有同样的错误,但根据 https://github.com/tyiannak/pyAudioAnalysis/issues/72 ,我将立体声音乐转换为单声道,它解决了我的问题。

关于python - pyAudioAnalysis 库错误 : cannot reshape array of size 4400 into shape (220, 10),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44622007/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com