madebyollin/acapellabot

TypeError: 'float' object cannot be interpreted as an index

Opened this issue · 3 comments

('\x1b[33m', 'Retrieved spectrogram; processing...', '\x1b[0m')
Traceback (most recent call last):
File "acapellabot.py", line 147, in
acapellabot.isolateVocals(f, args.fft, args.phase)
File "acapellabot.py", line 96, in isolateVocals
expandedSpectrogram = conversion.expandToGrid(spectrogram, self.peakDownscaleFactor)
File "/home/arka/Python/Working/VocalSeparation/vocal_separator/acapellabot-master/conversion.py", line 23, in expandToGrid
newSpectrogram = np.zeros((newX, newY))
TypeError: 'float' object cannot be interpreted as an index

Can any one please help me to fix this issue ?

Ah, that might be numpy being more strict than the version I was using. Can you try adding int() around the two float() calls? Like:

newY = int(ceil(spectrogram.shape[1] / gridSize) * gridSize)
newX = int(ceil(spectrogram.shape[0] / gridSize) * gridSize)

for lines 21/22?

If that works I can change it in the repo.

I have to change it to.
ceil(spectrogram.shape[1] / gridSize) * gridSize ==> spectrogram.shape[1]