sound-cnn icon indicating copy to clipboard operation
sound-cnn copied to clipboard

TypeError

Open stefan-reich opened this issue 7 years ago • 3 comments

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

stefan-reich avatar Aug 11 '17 22:08 stefan-reich

Any luck resolving above issue? @stefan-reich

StanSilas avatar Dec 15 '17 07:12 StanSilas

I don't know, what do you mean?

stefan-reich avatar Dec 16 '17 12:12 stefan-reich

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.

Bibobu avatar Feb 06 '18 11:02 Bibobu