Govert Jaap Den Boef Govert Jaap Den Boef - 1 year ago 135
Python Question

pyAudioAnalysis, Tuple index out of range

So I am trying to make a rudimentary emotion classifier using the pyAudioAnalysis library, and I have collected a small datasample to test if it works. my code is as following:

from pyAudioAnalysis import audioAnalysis as aA

aA.trainClassifierWrapper('svm', False,

If I execute this, it gives this error:

Traceback (most recent call last) <ipython-input-7-2e5393432e89> in <module>()
5 "C:\Users\gover_000\Desktop\Scared",
6 "C:\Users\gover_000\Desktop\Neutral"],
----> 7 "testSVM")

C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioAnalysis.pyc in trainClassifierWrapper(method, beatFeatures, directories, modelName)
88 raise Exception("At least 2 directories are needed")
89 aT.featureAndTrain(directories, 1, 1, aT.shortTermWindow, aT.shortTermStep,
---> 90 method.lower(), modelName, computeBEAT=beatFeatures)

C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioTrainTest.pyc in featureAndTrain(listOfDirs, mtWin, mtStep, stWin, stStep, classifierType, modelName, computeBEAT, perTrain)
275 featureNames = ["features" + str(d + 1) for d in range(numOfFeatures)]
--> 277 writeTrainDataToARFF(modelName, features, classNames, featureNames)
279 for i, f in enumerate(features):

C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioTrainTest.pyc in writeTrainDataToARFF(modelName, features, classNames, featureNames)
1097 for c, fe in enumerate(features):
1098 for i in range(fe.shape[0]):
-> 1099 for j in range(fe.shape[1]):
1100 f.write("{0:f},".format(fe[i, j]))
1101 f.write(classNames[c]+"\n")

IndexError: tuple index out of range

I know
is supposed to return the columns of an array dimension.
but why does it return an error here

Answer Source

Okay so I found the problem.

The problem was that one of my classifiers didn't have enough files, it needed atleast 2. so after adding more it worked again!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download