Merge branch 'dfsg-orig'
[debian/gnuradio] / gr-atsc / src / python / interp.py
1 #!/usr/bin/env /usr/bin/python
2 #
3 # Copyright 2004,2007 Free Software Foundation, Inc.
4
5 # This file is part of GNU Radio
6
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 3, or (at your option)
10 # any later version.
11
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.
16
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.
21
22 # This module starts the atsc processing chain taking the captured
23 # off-air signal created with:
24 #
25 #  usrp_rx_cfile.py -R <side with tuner, a or b>
26 #                   -d 10     set decimation to get signal at 6.4e6 rate
27 #                   -f <center of tv signal channel freq>
28 #                   -g <appropriate gain for best signal / noise>
29
30 # All this module does is multiply the sample rate by 3, from 6.4e6 to
31 # 19.2e6 complex samples / sec, then lowpass filter with a cutoff of 3.2MHz
32 # and a transition band width of .5MHz.  Center of the tv channels is
33 # then at 0 with edges at -3.2MHz and 3.2MHz.
34
35 from gnuradio import gr
36 import sys
37
38 def graph (args):
39
40     nargs = len (args)
41     if nargs == 1:
42         infile = args[0]
43     else:
44         sys.stderr.write('usage: interp.py input_file\n')
45         sys.exit (1)
46
47     tb = gr.top_block ()
48
49     src0 = gr.file_source (gr.sizeof_gr_complex,infile)
50
51     lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING )
52     lp = gr.interp_fir_filter_ccf ( 1, lp_coeffs )
53
54     file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
55
56     tb.connect( src0, lp, file )
57
58     tb.start()
59     raw_input ('Head End: Press Enter to stop')
60     tb.stop()
61
62 if __name__ == '__main__':
63     graph (sys.argv[1:])
64
65