sound-cnn
sound-cnn copied to clipboard
TypeError
Hi. First, I tested mono .wav files which resulted in an error.
Now I'm using stereo .wav files which results in another error.
stefan@stefan-quadcore ~/dev/sound-cnn-master $ ./doit.sh
Traceback (most recent call last):
File "train.py", line 20, in <module>
classes,trainX,trainYa,valX,valY,testX,testY = util.processAudio(bpm,samplingRate,mypath)
File "/home/stefan/dev/sound-cnn-master/utilities.py", line 24, in processAudio
audData = np.reshape(audData[1][:,1][0:samples*((seconds*samplingRate)/samples)],[samples,(seconds*samplingRate)/samples])
TypeError: slice indices must be integers or None or have an __index__ method
stefan@stefan-quadcore ~/dev/sound-cnn-master $ cat doit.sh
python3 train.py 240 44100 ../sounds-stereo/ 1000 100
Why does stuff not work in this world?
Cheers
Any luck resolving above issue? @stefan-reich
I don't know, what do you mean?
I think you're running the code with python3 but it was clearly written in python2. A major difference between the two is that / operator gives you float output in the former and integers in the latter.
Try using // operator instead, or running the code using python2, because the calculated values are used as slices index and need to be integers.