#!/usr/bin/env python # # Copyright 2004 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # fft example from http://comsec.com/wiki?AudioSpectrumDisplay # with ALSA and Bt878a parameters. # 08/2005 domenech.org from gnuradio import gr from gnuradio import audio from gnuradio.wxgui import stdgui, scopesink import wx from gnuradio.wxgui import fftsink samplfreq=896000 class app_flow_graph (stdgui.gui_flow_graph): def __init__(self, frame, panel, vbox, argv): stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv) src = audio.source (samplfreq, "hw:1,1") print src.relative_rate() print src.detail() sink, win = fftsink.make_fft_sink_f (self, panel, "Audio Spectrum Bt878a", 1024, samplfreq, -80, 0) print win.GetEnableZoom() win.SetEnableZoom(0) print win.GetYSpec() print win.GetXSpec() print win.GetBackgroundColour() win.SetBackgroundColour((0,0,0)) print win.GetBackgroundColour() print win.y_range vbox.Add (win, 1, wx.EXPAND) self.connect (src,sink) def main (): app = stdgui.stdapp (app_flow_graph, "Spectrum Analyzer") app.MainLoop () if __name__ == '__main__': main ()