3 # Copyright 2005 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Radio; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
23 from gnuradio import gr, gru, blks, eng_notation
24 from gnuradio import audio
25 from gnuradio.eng_option import eng_option
26 from optparse import OptionParser
31 class my_graph(gr.flow_graph):
32 def __init__(self, output_filename, tx_gain, nsamples):
33 gr.flow_graph.__init__(self)
38 src = gr.noise_source_c(gr.GR_GAUSSIAN, 1.0)
39 #src = gr.noise_source_f(gr.GR_GAUSSIAN, 0.5)
40 #guts = blks.wfm_tx(self, audio_rate, baseband_rate)
41 amp = gr.multiply_const_cc(tx_gain)
42 head = gr.head(gr.sizeof_gr_complex, nsamples)
43 sink = gr.file_sink(gr.sizeof_gr_complex, output_filename)
44 self.connect(src, amp, head, sink)
47 usage = "usage: %prog [options] output_filename"
48 parser = OptionParser (option_class=eng_option, usage=usage)
49 parser.add_option("-N", "--nsamples", type="eng_float", default=250000,
50 help="specify number of output samples to generate[=250000]")
51 parser.add_option("-g", "--tx-gain", type="eng_float", default=1.0,
52 help="specify transmitter gain[=1]")
53 (options, args) = parser.parse_args ()
60 my_graph(args[0], options.tx_gain, int(options.nsamples)).run()
61 except KeyboardInterrupt:
65 if __name__ == '__main__':