Closed filipthor closed 3 years ago
"ugly-fixed" it by wrapping i and j with int(), which seems to work
In the current version,
step = int(seg_length // 2)
so i
and j
should already be int
s.
Maybe you have an older version of thinkdsp.py?
I just ran a test with current version and all is well.
As the title reads, I have hit a bit of a snub trying the code out.
Trying to run the code: import thinkdsp
wave = thinkdsp.read_wave('100475iluppaisaxophone-weep.wav') spectrogram = wave.make_spectrogram(seg_length=512) spectrogram.plot(high=700)
on Python 3.6, resulting in: Traceback (most recent call last): ... File "/Users/filipthor/PycharmProjects/music/main.py", line 9, in
spectrogram = wave.make_spectrogram(seg_length=512)
File "/Users/filipthor/anaconda/lib/python3.6/site-packages/thinkdsp.py", line 943, in make_spectrogram
segment = self.slice(i, j)
File "/Users/filipthor/anaconda/lib/python3.6/site-packages/thinkdsp.py", line 897, in slice
ys = self.ys[i:j].copy()
TypeError: slice indices must be integers or None or have an index method
Any ideas?