Python Forum
[PyQt] Assign Label Text as number in Hz
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Assign Label Text as number in Hz
#6
(Jul-03-2018, 04:17 PM)Alfalfa Wrote: Hi there,
I'm not sure about how you want to use it in your code, but QTimer are very easy. Like I shown you, you can simply init it in the __init__ of your gui loop (SoundApp), then use self.timer to manipulate it if needed. You don't need to init a new singleshot timer recursively like you've done (line 36). Single shots timers are.. for single shot. They fire only once. If you want to repeat an action every few seconds, simply init a QTimer with an interval, then start it and it will loop forever.

Thank you so much!! Big Grin
I'll try it right away when I get home, and see if there's any problem while I processing it

(Jul-03-2018, 10:02 PM)DeaD_EyE Wrote: Hello, I can only help a bit with signal processing.
Instead of making a fft and throwing the negative frequencies away, you should do a rfft.

Here a corrected version and additional the same with a rfft.

def getFFT(data, rate):
    """Given some data and rate, returns FFTfreq and FFT (half)."""
    window_size = len(data)
    data *= np.hamming(window_size)
    fft = np.fft.fft(data).real
    freq = np.fft.fftfreq(window_size, 1.0 / rate)
    half_size = slice(None, window_size // 2)
    return freq[half_size], fft[half_size]


def getRFFT(data, rate):
    """Given some data and rate, returns RFFTfreq and RFFT."""
    window_size = len(data)
    data *= np.hamming(window_size)
    rfft = np.fft.rfft(data).real
    freq = np.fft.rfftfreq(window_size, 1.0 / rate)
    return freq, rfft

Thank you so much! I'll try to changed the FFT then and see the results
but I have a question if I want to change the number that written in the axis XY inside the graph to alphabet like ABCD instead 0123, how can I do that?

I want to make a marker for some number into alphabet like 198 into G, 440 into A, etc
Reply


Messages In This Thread
Assign Label Text as number in Hz - by mekha - Jul-01-2018, 12:45 PM
RE: Assign Label Text as number in Hz - by Alfalfa - Jul-01-2018, 05:28 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-01-2018, 11:12 PM
RE: Assign Label Text as number in Hz - by Alfalfa - Jul-03-2018, 04:17 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-04-2018, 01:44 AM
RE: Assign Label Text as number in Hz - by mekha - Jul-07-2018, 02:44 AM
RE: Assign Label Text as number in Hz - by Alfalfa - Jul-10-2018, 04:26 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-11-2018, 04:18 AM
RE: Assign Label Text as number in Hz - by DeaD_EyE - Jul-03-2018, 10:02 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-07-2018, 01:14 AM
RE: Assign Label Text as number in Hz - by DeaD_EyE - Jul-04-2018, 10:30 AM
RE: Assign Label Text as number in Hz - by mekha - Jul-12-2018, 01:48 PM
RE: Assign Label Text as number in Hz - by Alfalfa - Jul-12-2018, 09:38 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-16-2018, 11:39 AM
RE: Assign Label Text as number in Hz - by Alfalfa - Jul-16-2018, 12:45 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-16-2018, 01:59 PM
RE: Assign Label Text as number in Hz - by Alfalfa - Jul-16-2018, 04:35 PM
RE: Assign Label Text as number in Hz - by mekha - Jul-18-2018, 12:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to update label text using a grid button. Edward_ 7 1,916 Dec-18-2024, 03:05 AM
Last Post: Edward_
  update text variable on label with keypress knoxvilles_joker 5 7,917 May-31-2024, 02:09 PM
Last Post: menator01
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 10,752 Jun-26-2022, 06:26 PM
Last Post: menator01
  How to read text in kivy textinput or Label jadel440 1 6,650 Dec-29-2020, 10:47 AM
Last Post: joe_momma
  Tkinter: How to assign calculated value to a Label LoneStar 7 6,654 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  [Kivy] Kivy text label won't shows up! AVD_01 1 3,917 Jun-21-2020, 04:01 PM
Last Post: AVD_01
  [Tkinter] Python 3 change label text gw1500se 6 6,711 May-08-2020, 05:47 PM
Last Post: deanhystad
  [Tkinter] how to update label text from list Roshan 8 7,535 Apr-25-2020, 08:04 AM
Last Post: Roshan
  [PyQt] Python PyQt5 - Change label text dynamically based on user Input ppel123 1 16,233 Mar-20-2020, 07:21 AM
Last Post: deanhystad
  [Tkinter] Label, align imported text from pandas kundrius 2 5,617 Dec-11-2019, 08:26 AM
Last Post: kundrius

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020