Exemplo n.º 1
0
 def test001_module_load(self):
     data = 20 * (100, 200, 300, 400, 500, 600, 700, 800)
     expected_data = (0, 0, 0, 3, 2, 0, 1, 5, 6, 7, 1, -1, 0, -5, -11, -10,
                      -20, -22, -20, -20, -27, -26, -36, -48, -59, -24, 5,
                      -7, -12, -27, -22, -22, -16, 13, 20, 39, 23, 25, 8,
                      -6, 15, 44, 97, 135, 145, 125, 94, 102, 126, 129, 165,
                      192, 180, 132, 99, 79, 73, 83, 72, 47, 40, 0, -32,
                      -46, -67, -99, -123, -114, -87, -108, -131, -152,
                      -181, -245, -348, -294, -101, -71, -85, -26, 99, 123,
                      15, 2, 77, 13, -117, -145, -105, -39, -50, -89, -59,
                      -77, -134, -95, -51, -22, 17, -19, -59, -74, -103,
                      -78, 4, 77, 113, 60, 18, 13, -67, -49, 24, 88, 179,
                      190, 89, 18, -90, -102, -50, -5, 123, 135, 57, 31,
                      -82, -98, -51, 6, 93, 104, 44, -5, -84, -107, -44, 45,
                      102, 104, 15, -47, -107, -126, -87, -11, 89, 93, 13,
                      -95, -136, -187, -70, -167, 216, -70, -103, 175, -284,
                      -486)
     src = blocks.vector_source_s(data)
     enc = vocoder.codec2_encode_sp()
     dec = vocoder.codec2_decode_ps()
     snk = blocks.vector_sink_s()
     self.tb.connect(src, enc, dec, snk)
     self.tb.run()
     actual_result = snk.data()
     self.assertEqual(expected_data, actual_result)
def build_graph():
    tb = gr.top_block()
    src = audio.source(8000)
    src_scale = blocks.multiply_const_ff(32767)
    f2s = blocks.float_to_short()
    enc = vocoder.codec2_encode_sp(codec2.MODE_2400)
    dec = vocoder.codec2_decode_ps(codec2.MODE_2400)
    s2f = blocks.short_to_float()
    sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
    sink = audio.sink(8000)
    tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
    return tb
Exemplo n.º 3
0
def build_graph():
    tb = gr.top_block()
    src = audio.source(8000)
    src_scale = blocks.multiply_const_ff(32767)
    f2s = blocks.float_to_short()
    enc = vocoder.codec2_encode_sp(codec2.MODE_2400)
    dec = vocoder.codec2_decode_ps(codec2.MODE_2400)
    s2f = blocks.short_to_float()
    sink_scale = blocks.multiply_const_ff(1.0 / 32767.0)
    sink = audio.sink(8000)
    tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
    return tb
Exemplo n.º 4
0
    def test001_module_load (self):
        data = 40*(100,200,300,400,500,600,700,800)
        expected_data = (0, 5, 10, 14, 15, 13, 14, 20, 40, 46, 39, 36, 35, 33, 22, 17, 31, 34, 29, 24, 24, 15, -3, -8, -7, 1, -4, -11, -14, -22, -39, -53, -51, -52, -58, -58, -59, -58, -61, -74, -73, -79, -75, -61, -73, -76, -72, -75, -62, -74, -75, -64, -64, -59, -61, -49, -68, -60, -23, -46, -48, -33, -48, 2, 20, -3, 2, -8, 9, 38, 9, 16, 23, 16, 44, 65, 37, 24, 25, 55, 61, 57, 52, 39, 47, 57, 66, 73, 50, 46, 47, 55, 55, 45, 73, 86, 63, 66, 60, 55, 60, 55, 71, 59, 46, 58, 46, 2, 38, 50, 33, 41, 32, 0, -16, -11, 10, 16, -13, 0, -5, -33, -45, -38, -28, -24, -41, 21, -2, -53, -55, -74, -66, -64, -64, -41, -46, -94, -122, -130, -92, -126, -104, -90, -74, -118, -162, -154, -130, -133, -163, -18, -23, -155, -95, -145, -60, -63, 156, 864, 882, 607, 449, 163, 204, 17, 47, 612, 447, 200, -59, -188, -175, -418, -192, 170, 14, -73, -258, -276, -267, -335, -117, 96, 34, -28, -152, -130, -124, -187, 42, 176, 131, 78, -52, -2, -57, -75, 104, 130, 111, 29, -50, -46, -107, -64, 66, 36, 33, -39, -129, -91, -157, -39, 69, 1, -12, -84, -99, -52, -61, 86, 147, 58, 21, -63, -60, -100, -48, 68, 76, 6, -65, -79, -108, -159, -71, 89, 171, 183, 216, 152, 26, -35, 0, 87, 126, 143, 182, 151, 95, 106, 115, 155, 103, 86, 127, 12, -41, -91, -87, -32, -52, -41, -32, -123, -147, -154, -156, -61, -37, -8, -51, -127, -132, -127, -107, -54, 1, 26, -17, -100, -61, -9, 3, 57, 117, 102, 58, -47, 24, 67, 42, 116, 141, 113, 39, -15, 63, 68, 41, 118, 80, 24, -46, -72, 12, 5, -17, 18, -43, -61, -110, -119, -42, -40, -16, 2, -11, -50)

        src = blocks.vector_source_s(data)
        enc = vocoder.codec2_encode_sp(codec2.MODE_2400)
        dec = vocoder.codec2_decode_ps(codec2.MODE_2400)
        snk = blocks.vector_sink_s()
        self.tb.connect(src, enc, dec, snk)
        self.tb.run()
        actual_result = snk.data()
        self.assertEqual(expected_data, actual_result)
        self.tb.disconnect(src, enc, dec, snk)
Exemplo n.º 5
0
 def test001_module_load (self):
     data = 20*(100,200,300,400,500,600,700,800)
     expected_data = (0,0,0,3,2,0,1,5,6,7,1,-1,0,-5,-11,-10,-20,-22,
                      -20,-20,-27,-26,-36,-48,-59,-24,5,-7,-12,-27,-22,
                      -22,-16,13,20,39,23,25,8,-6,15,44,97,135,145,125,
                      94,102,126,129,165,192,180,132,99,79,73,83,72,47,
                      40,0,-32,-46,-67,-99,-123,-114,-87,-108,-131,-152,
                      -181,-245,-348,-294,-101,-71,-85,-26,99,123,15,2,77,
                      13,-117,-145,-105,-39,-50,-89,-59,-77,-134,-95,-51,
                      -22,17,-19,-59,-74,-103,-78,4,77,113,60,18,13,-67,
                      -49,24,88,179,190,89,18,-90,-102,-50,-5,123,135,57,
                      31,-82,-98,-51,6,93,104,44,-5,-84,-107,-44,45,102,104,
                      15,-47,-107,-126,-87,-11,89,93,13,-95,-136,-187,-70,
                      -167,216,-70,-103,175,-284,-486)
     src = blocks.vector_source_s(data)
     enc = vocoder.codec2_encode_sp()
     dec = vocoder.codec2_decode_ps()
     snk = blocks.vector_sink_s()
     self.tb.connect(src, enc, dec, snk)
     self.tb.run()
     actual_result = snk.data()
     self.assertEqual(expected_data, actual_result)
Exemplo n.º 6
0
    def test001_module_load(self):
        data = 40 * (100, 200, 300, 400, 500, 600, 700, 800)
        expected_data = (
            0, 5, 10, 14, 15, 13, 14, 20, 40, 46, 39, 36, 35, 33, 22, 17, 31,
            34, 29, 24, 24, 15, -3, -8, -7, 1, -4, -11, -14, -22, -39, -53,
            -51, -52, -58, -58, -59, -58, -61, -74, -73, -79, -75, -61, -73,
            -76, -72, -75, -62, -74, -75, -64, -64, -59, -61, -49, -68, -60,
            -23, -46, -48, -33, -48, 2, 20, -3, 2, -8, 9, 38, 9, 16, 23, 16,
            44, 65, 37, 24, 25, 55, 61, 57, 52, 39, 47, 57, 66, 73, 50, 46, 47,
            55, 55, 45, 73, 86, 63, 66, 60, 55, 60, 55, 71, 59, 46, 58, 46, 2,
            38, 50, 33, 41, 32, 0, -16, -11, 10, 16, -13, 0, -5, -33, -45, -38,
            -28, -24, -41, 21, -2, -53, -55, -74, -66, -64, -64, -41, -46, -94,
            -122, -130, -92, -126, -104, -90, -74, -118, -162, -154, -130,
            -133, -163, -18, -23, -155, -95, -145, -60, -63, 156, 864, 882,
            607, 449, 163, 204, 17, 47, 612, 447, 200, -59, -188, -175, -418,
            -192, 170, 14, -73, -258, -276, -267, -335, -117, 96, 34, -28,
            -152, -130, -124, -187, 42, 176, 131, 78, -52, -2, -57, -75, 104,
            130, 111, 29, -50, -46, -107, -64, 66, 36, 33, -39, -129, -91,
            -157, -39, 69, 1, -12, -84, -99, -52, -61, 86, 147, 58, 21, -63,
            -60, -100, -48, 68, 76, 6, -65, -79, -108, -159, -71, 89, 171, 183,
            216, 152, 26, -35, 0, 87, 126, 143, 182, 151, 95, 106, 115, 155,
            103, 86, 127, 12, -41, -91, -87, -32, -52, -41, -32, -123, -147,
            -154, -156, -61, -37, -8, -51, -127, -132, -127, -107, -54, 1, 26,
            -17, -100, -61, -9, 3, 57, 117, 102, 58, -47, 24, 67, 42, 116, 141,
            113, 39, -15, 63, 68, 41, 118, 80, 24, -46, -72, 12, 5, -17, 18,
            -43, -61, -110, -119, -42, -40, -16, 2, -11, -50)

        src = blocks.vector_source_s(data)
        enc = vocoder.codec2_encode_sp(codec2.MODE_2400)
        dec = vocoder.codec2_decode_ps(codec2.MODE_2400)
        snk = blocks.vector_sink_s()
        self.tb.connect(src, enc, dec, snk)
        self.tb.run()
        actual_result = snk.data()
        self.assertEqual(expected_data, actual_result)
        self.tb.disconnect(src, enc, dec, snk)
Exemplo n.º 7
0
    def __init__(self):
        gr.top_block.__init__(self, "P25 Txrx Simple")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("P25 Txrx Simple")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "p25_txrx_simple")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Blocks
        ##################################################
        self.vocoder_codec2_encode_sp_0 = vocoder.codec2_encode_sp(
            codec2.MODE_3200)
        self.vocoder_codec2_decode_ps_0 = vocoder.codec2_decode_ps(
            codec2.MODE_3200)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/irt/Downloads/sentence2.wav', False)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_char * 1, 64)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, 8000,
                                                 True)
        self.blocks_tagged_stream_to_pdu_0 = blocks.tagged_stream_to_pdu(
            blocks.byte_t, 'packet_len')
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_char * 1, 64)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, 64, "packet_len")
        self.blocks_socket_pdu_1 = blocks.socket_pdu("UDP_SERVER", '0.0.0.0',
                                                     '10500', 10000, False)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT",
                                                     '192.168.1.214', '10500',
                                                     10000, False)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32768)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 32768)
        self.audio_sink_0 = audio.sink(8000, '', True)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_socket_pdu_1, 'pdus'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.blocks_tagged_stream_to_pdu_0, 'pdus'),
                         (self.blocks_socket_pdu_0, 'pdus'))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.vocoder_codec2_encode_sp_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.blocks_tagged_stream_to_pdu_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.vocoder_codec2_decode_ps_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.vocoder_codec2_decode_ps_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.vocoder_codec2_encode_sp_0, 0),
                     (self.blocks_vector_to_stream_0, 0))