Esempio n. 1
0
 def test001_module_load(self):
     data = 20 * (100, 200, 300, 400, 500, 600, 700, 800)
     expected_data = (0, 0, 360, 304, 256, 720, 600, 504, 200, 144, 128,
                      464, 376, 384, 680, 576, 440, 264, 176, 176, 640, 520,
                      480, 464, 384, 288, 432, 296, 328, 760, 624, 504, 176,
                      96, 96, 416, 312, 360, 808, 672, 216, 104, 136, 504,
                      376, 448, 720, 608, 296, 304, 176, 336, 576, 456, 560,
                      512, 320, 216, 344, 264, 456, 672, 576, 488, 192, 80,
                      152, 424, 368, 552, 688, 560, 280, 200, 104, 256, 520,
                      464, 608, 488, 184, 104, 16, 472, 456, 360, 696, 568,
                      208, 136, 88, 376, 480, 456, 616, 472, 232, 224, 264,
                      320, 512, 624, 632, 520, 176, 80, 192, 304, 400, 592,
                      664, 552, 248, 152, 144, 336, 440, 520, 616, 664, 304,
                      176, 80, 536, 448, 376, 680, 600, 240, 168, 112, 408,
                      488, 472, 608, 480, 240, 232, 208, 288, 480, 600, 616,
                      520, 176, 88, 184, 296, 392, 584, 656, 552, 248, 160,
                      144, 336, 432, 512, 608, 664)
     src = blocks.vector_source_s(data)
     enc = vocoder.gsm_fr_encode_sp()
     dec = vocoder.gsm_fr_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.gsm_fr_encode_sp()
    dec = vocoder.gsm_fr_decode_ps()
    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
def build_graph():
    tb = gr.top_block()
    src = audio.source(8000)
    src_scale = gr.multiply_const_ff(32767)
    f2s = gr.float_to_short ()
    enc = vocoder.gsm_fr_encode_sp()
    dec = vocoder.gsm_fr_decode_ps()
    s2f = gr.short_to_float ()
    sink_scale = gr.multiply_const_ff(1.0/32767.)
    sink = audio.sink(8000)
    tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
    return tb
Esempio n. 4
0
    def __init__(self, audio_input_dev):
	gr.hier_block2.__init__(self, "audio_rx",
				gr.io_signature(0, 0, 0), # Input signature
				gr.io_signature(0, 0, 0)) # Output signature
        self.sample_rate = sample_rate = 8000
        src = audio.source(sample_rate, audio_input_dev)
        src_scale = blocks.multiply_const_ff(32767)
        f2s = blocks.float_to_short()
        voice_coder = vocoder.gsm_fr_encode_sp()
        self.packets_from_encoder = gr.msg_queue()
        packet_sink = blocks.message_sink(33, self.packets_from_encoder, False)
        self.connect(src, src_scale, f2s, voice_coder, packet_sink)
Esempio n. 5
0
    def __init__(self, audio_input_dev):
	gr.hier_block2.__init__(self, "audio_rx",
				gr.io_signature(0, 0, 0), # Input signature
				gr.io_signature(0, 0, 0)) # Output signature
        self.sample_rate = sample_rate = 8000
        src = audio.source(sample_rate, audio_input_dev)
        src_scale = blocks.multiply_const_ff(32767)
        f2s = blocks.float_to_short()
        voice_coder = vocoder.gsm_fr_encode_sp()
        self.packets_from_encoder = gr.msg_queue()
        packet_sink = blocks.message_sink(33, self.packets_from_encoder, False)
        self.connect(src, src_scale, f2s, voice_coder, packet_sink)
Esempio n. 6
0
 def test001_module_load (self):
     data = 20*(100,200,300,400,500,600,700,800)
     expected_data = (0,0,360,304,256,720,600,504,200,144,128,464,
                      376,384,680,576,440,264,176,176,640,520,480,
                      464,384,288,432,296,328,760,624,504,176,96,96,
                      416,312,360,808,672,216,104,136,504,376,448,
                      720,608,296,304,176,336,576,456,560,512,320,
                      216,344,264,456,672,576,488,192,80,152,424,
                      368,552,688,560,280,200,104,256,520,464,608,
                      488,184,104,16,472,456,360,696,568,208,136,88,
                      376,480,456,616,472,232,224,264,320,512,624,
                      632,520,176,80,192,304,400,592,664,552,248,152,
                      144,336,440,520,616,664,304,176,80,536,448,376,
                      680,600,240,168,112,408,488,472,608,480,240,232,
                      208,288,480,600,616,520,176,88,184,296,392,584,
                      656,552,248,160,144,336,432,512,608,664)
     src = blocks.vector_source_s(data)
     enc = vocoder.gsm_fr_encode_sp()
     dec = vocoder.gsm_fr_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)