Zulko / pianoputer

Use your computer keyboard as a "piano".
http://zulko.github.io/blog/2014/03/29/soundstretching-and-pitch-shifting-in-python/
Other
324 stars 89 forks source link

Convert float indices (issue #7) #8

Closed schneiderfelipe closed 6 years ago

schneiderfelipe commented 6 years ago

This solves the following error (issue #7):

$ python pianoputer.py          
Transponding sound file... Traceback (most recent call last):
  File "pianoputer.py", line 127, in <module>
    main()
  File "pianoputer.py", line 91, in main
    transposed_sounds = [pitchshift(sound, n) for n in tones]
  File "pianoputer.py", line 50, in pitchshift
    stretched = stretch(snd_array, 1.0/factor, window_size, h)
  File "pianoputer.py", line 26, in stretch
    a1 = snd_array[i: i + window_size]
TypeError: slice indices must be integers or None or have an __index__ method

The solution was suggested by @wupanhao.

Zulko commented 6 years ago

thanks !