0

i found a piece of code online that virtualises audio input into a graph in real time. i have installed the newest versions of pyaudio and matplotlib

https://gist.github.com/livibetter/4118062

(the on labeled sound-spectrum.py)

when i run the code, it opens the window containing the graph, but i geth this error message:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__
    return self.func(*args)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 745, in callit
    func(*args)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 144, in _on_timer
    TimerBase._on_timer(self)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\backend_bases.py", line 1311, in _on_timer
    ret = func(*args, **kwargs)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\animation.py", line 1241, in _step
    still_going = Animation._step(self, *args)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\animation.py", line 1030, in _step
    self._draw_next_frame(framedata, self._blit)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\animation.py", line 1049, in _draw_next_frame
    self._draw_frame(framedata)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\animation.py", line 1512, in _draw_frame
    self._drawn_artists = self._func(framedata, *self._args)
  File "C:\Users\Tonif\Documents\computer science\sound.py", line 26, in animate
    data = stream.read(N)
  File "C:\Users\Tonif\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyaudio.py", line 608, in read
    return pa.read_stream(self._stream, num_frames, exception_on_overflow)
TypeError: integer argument expected, got float

any help would be muh appreciated.

toni
  • 57
  • 1
  • 1
  • 3

0 Answers0