1 #!/usr/bin/env /usr/bin/python
3 # Copyright 2004 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.
22 # This module starts the atsc processing chain taking the captured
23 # off-air signal created with:
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>
31 # All this module does is multiply the sample rate by 3, from 6.4e6 to
32 # 19.2e6 complex samples / sec, then lowpass filter with a cutoff of 3.2MHz
33 # and a transition band width of .5MHz. Center of the tv channels is
34 # then at 0 with edges at -3.2MHz and 3.2MHz.
36 from gnuradio import gr
47 sys.stderr.write('usage: interp.py input_file\n')
52 srcf = gr.file_source (gr.sizeof_short,infile)
53 s2ss = gr.stream_to_streams(gr.sizeof_short,2)
54 s2f1 = gr.short_to_float()
55 s2f2 = gr.short_to_float()
56 src0 = gr.float_to_complex()
59 lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING )
60 lp = gr.interp_fir_filter_ccf ( 3, lp_coeffs )
62 file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
64 tb.connect( srcf, s2ss )
65 tb.connect( (s2ss, 0), s2f1, (src0,0) )
66 tb.connect( (s2ss, 1), s2f2, (src0,1) )
67 tb.connect( src0, lp, file)
70 raw_input ('Head End: Press Enter to stop')
73 if __name__ == '__main__':