Advertisement
Guest User

Untitled

a guest
Nov 15th, 2013
118
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. ##################################################
  3. # Gnuradio Python Flow Graph
  4. # Title: Top Block
  5. # Generated: Fri Nov 15 12:03:15 2013
  6. ##################################################
  7.  
  8. from gnuradio import analog
  9. from gnuradio import audio
  10. from gnuradio import eng_notation
  11. from gnuradio import filter
  12. from gnuradio import gr
  13. from gnuradio.eng_option import eng_option
  14. from gnuradio.filter import firdes
  15. from grc_gnuradio import wxgui as grc_wxgui
  16. from optparse import OptionParser
  17. import wx
  18.  
  19. class top_block(grc_wxgui.top_block_gui):
  20.  
  21.     def __init__(self):
  22.         grc_wxgui.top_block_gui.__init__(self, title="Top Block")
  23.  
  24.         ##################################################
  25.         # Variables
  26.         ##################################################
  27.         self.samp_rate = samp_rate = 1e6
  28.  
  29.         ##################################################
  30.         # Blocks
  31.         ##################################################
  32.         self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
  33.                 interpolation=2,
  34.                 decimation=7,
  35.                 taps=None,
  36.                 fractional_bw=None,
  37.         )
  38.         self.audio_sink_0 = audio.sink(24000, "", True)
  39.         self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
  40.  
  41.         ##################################################
  42.         # Connections
  43.         ##################################################
  44.         self.connect((self.analog_sig_source_x_0, 0), (self.rational_resampler_xxx_0, 0))
  45.         self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
  46.         self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 1))
  47.  
  48.  
  49. # QT sink close method reimplementation
  50.  
  51.     def get_samp_rate(self):
  52.         return self.samp_rate
  53.  
  54.     def set_samp_rate(self, samp_rate):
  55.         self.samp_rate = samp_rate
  56.         self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
  57.  
  58. if __name__ == '__main__':
  59.     import ctypes
  60.     import os
  61.     if os.name == 'posix':
  62.         try:
  63.             x11 = ctypes.cdll.LoadLibrary('libX11.so')
  64.             x11.XInitThreads()
  65.         except:
  66.             print "Warning: failed to XInitThreads()"
  67.     parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
  68.     (options, args) = parser.parse_args()
  69.     tb = top_block()
  70.     tb.Start(True)
  71.     tb.Wait()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement