Audio-Spectrum-Analyzer-in-Python icon indicating copy to clipboard operation
Audio-Spectrum-Analyzer-in-Python copied to clipboard

Odd error in attempts to run audio_spectrum.py

Open zipzit opened this issue 7 years ago • 2 comments

I'm a bit new to Python and some of the modules used here. Odd errors, that I'm just unable to troubleshoot.

 thismanager.window.setGeometry( 5, 120, 1910, 1070)
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1952, in __getattr__
    return getattr(self.tk, attr)
AttributeError: '_tkinter.tkapp' object has no attribute 'setGeometry'

I'm using Python3 on a Xubuntu (Ubuntu with XFCE) in a virtualbox. I've tested pyAudio samples so I know microphone (and speakers) are fully functional. Running in a Python virtual environment.

Note: I'm able to run $ python3 audio_spectrumQT.py successfully in the same virtualbox. Works just fine.

Any clue as to what's going on here?

Many thanks to Mark Jay for the youtube videos and this github repo, enabling us to better learn how Fast Fourier Transforms (FFT) work.

reference:

Let's Build an Audio Spectrum Analyzer in Python! (pt. 1) the waveform viewer.
https://www.youtube.com/watch?v=AShHJdSIxkY
Mark Jay        Published on Sep 9, 2017

Let's Build an Audio Spectrum Analyzer in Python! (pt. 2) the spectrum viewer
https://www.youtube.com/watch?v=aQKX3mrDFoY
Mark Jay        Published on Sep 10, 2017

Let's Build an Audio Spectrum Analyzer in Python! (pt. 3) Switching to PyQtGraph
https://www.youtube.com/watch?v=RHmTgapLu4s
Mark Jay        Published on Oct 8, 2017

zipzit avatar Mar 25 '18 03:03 zipzit

Been attempting to learn what's going on here... I'm coming from a heavy JavaScript/node background with mere familiarity with Python. Been studying up on numpy and matplotlib.pyplot

# show axes
thismanager = plt.get_current_fig_manager()
thismanager.window.setGeometry(5, 120, 1910, 1070)
plt.show(block=False)

I'm way confused by the comment # show axes Is that what you are doing here, displaying the axes on a two plot figure?

When I go to source, In [xx]: matplotlib.pyplot.figure? I see:

Signature: matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, **kwargs)
Docstring:
Creates a new figure.
...
figsize : tuple of integers, optional, default: None
    width, height in inches. If not provided, defaults to rc
    figure.figsize.

I see nothing that remotely matches up to (5, 120, 1910, 1070) Am I analyzing this correctly?

Oh, wait...

I just found this stackoverflow posting... looks like thismanager.window is a tkinter thing (?)

Perhaps one of the flavors of figManager.window.showMaximized() (as shown in the responses to the stackoverflow question above) are more appropriate for this exercise?

zipzit avatar Mar 26 '18 14:03 zipzit

you can remove the line for setGeometry. I only used it so the window would pop up in the center of why screen where I record.

markjay4k avatar Mar 27 '18 04:03 markjay4k