Forum: GNU Radio Problem with FFT of simple signal

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1be216aeebab87cb3d905d03cfaae5e2?d=identicon&s=25 Emil Molin (Guest)
on 2009-01-30 17:04
(Received via mailing list)
Im learning about gnuradio for my final thesis (quite common i see) and
i
wanted to show a simple FFT of a simple signal (or noise) but the only
thing
i get the GUI working for is audio input from the microphone. Running it
with a generated signal causes the program to freeze.
Here is my code: (ive commented out the non working parts)

#!/usr/bin/env python

from gnuradio import gr,gru
from gnuradio import audio
from gnuradio.wxgui import stdgui2, fftsink2
import wx
import sys

class app_top_block(stdgui2.std_top_block):
    def __init__(self,frame,panel,vbox,argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
        sample_rate=44100
        self.frame = frame
        self.panel = panel
        self.vbox = vbox

        #self.soundsrc =
gr.sig_source_f(sample_rate,gr.GR_SIN_WAVE,350,0.1)
#NOTE:Doesnt Work
        self.soundsrc = audio.source(sample_rate,"")    #Works
        #self.soundsrc = gr.noise_source_f(gr.GR_UNIFORM,0.1)    #Doesnt
work

        self.scope = fftsink2.fft_sink_f(panel, fft_size=1024,
sample_rate=sample_rate, fft_rate=30,ref_scale=1.0, ref_level=0,
y_divs=12)
        self.connect(self.soundsrc,self.scope)
        vbox.Add(self.scope.win, 10, wx.EXPAND)

if __name__ == "__main__":
    app = stdgui2.stdapp(app_top_block,"Tone FFT",nstatus=1)
    app.MainLoop()
3d593de8acbe2510722af740d8668352?d=identicon&s=25 Firas Abbas (Guest)
on 2009-01-30 18:13
(Received via mailing list)
Hi,


> On Fri, 1/30/09, Emil Molin <molin.emil@gmail.com> wrote:
>
> Running it with a generated signal causes the program to freeze.
>
>

This is normal since there is no sampling rate control in your code and
your CPU will be eaten. To overcome this problem use gr.throttle API in
you code.


Best Regards,

Firas
This topic is locked and can not be replied to.