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
45 sys.stderr.write('usage: interp.py input_file\n')
48 sampling_freq = 6400000
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()
58 src1 = gr.sig_source_c (sampling_freq, gr.GR_CONST_WAVE, 1, 0)
59 src2 = gr.sig_source_c (sampling_freq, gr.GR_CONST_WAVE, 1, 0)
61 interlv = gr.interleave(gr.sizeof_gr_complex)
63 lp_coeffs = gr.firdes.low_pass ( 3, 19.2e6, 3.2e6, .5e6, gr.firdes.WIN_HAMMING )
64 lp = gr.fir_filter_ccf ( 1, lp_coeffs )
66 file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
68 fg.connect( srcf, s2ss )
69 fg.connect( (s2ss, 0), s2f1)
70 fg.connect( (s2ss, 1), s2f2)
71 fg.connect( s2f1, (src0,0) )
72 fg.connect( s2f2, (src0,1) )
73 fg.connect( src0, (interlv, 0) )
74 fg.connect( src1, (interlv, 1) )
75 fg.connect( src2, (interlv, 2) )
76 fg.connect( interlv, lp, file )
79 raw_input ('Head End: Press Enter to stop')
82 if __name__ == '__main__':