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()