Merge commit 'v3.3.0' into upstream
[debian/gnuradio] / gr-atsc / src / python / xlate.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 upconverts the 19.2e6 sample rate signal from a center
23 # of 0 to 5.75e6 and converts to float, to prepare the signal for
24 # the old gnuradio 0.9 block (bit timing loop, field sync checker,
25 # equalizer and field sync demux), effectively simulating an
26 # mc4020 card, except the sample rate is 19.2e6 instead of 20e6.
27 #
28 # The signal is then centered on 5.75e6 with edges at 5.75 + 3.2 = 8.95MHz
29 # and 5.75 - 3.2 = 2.55Mhz, low pass filtered with cutoff at 9Mhz and a
30 # transition band width of 1Mhz.
31 #
32 # Input complex -3.2 to 3.2Mhz, output float 2.55 to 8.95Mhz.
33
34 from gnuradio import gr
35 import os
36
37 def graph ():
38     print os.getpid()
39     sampling_freq = 19200000
40
41     tb = gr.top_block ()
42
43     src0 = gr.file_source (gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
44
45     duc_coeffs = gr.firdes.low_pass ( 1, 19.2e6, 9e6, 1e6, gr.firdes.WIN_HAMMING )
46     duc = gr.freq_xlating_fir_filter_ccf ( 1, duc_coeffs, 5.75e6, 19.2e6 )
47
48     c2f = gr.complex_to_float()
49     file = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2")
50
51     tb.connect( src0, duc, c2f, file )
52
53     tb.run()
54
55 if __name__ == '__main__':
56     graph ()