summaryrefslogtreecommitdiff
path: root/gr-digital/examples/rx_voice.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/examples/rx_voice.py')
-rwxr-xr-xgr-digital/examples/rx_voice.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/gr-digital/examples/rx_voice.py b/gr-digital/examples/rx_voice.py
index d29d64ed6..b58704e16 100755
--- a/gr-digital/examples/rx_voice.py
+++ b/gr-digital/examples/rx_voice.py
@@ -20,17 +20,13 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
-from gnuradio import uhd
-from gnuradio import audio
+from gnuradio import gr, blks2, audio, uhd
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-from gnuradio.vocoder import gsm_full_rate
-
-# From gr-digital
from gnuradio import digital
+from gnuradio import vocoder
import random
import struct
@@ -38,6 +34,7 @@ import sys
# from current dir
from receive_path import receive_path
+from uhd_interface import uhd_receiver
#import os
#print os.getpid()
@@ -50,9 +47,9 @@ class audio_tx(gr.hier_block2):
gr.io_signature(0, 0, 0), # Input signature
gr.io_signature(0, 0, 0)) # Output signature
- sample_rate = 8000
+ self.sample_rate = sample_rate = 8000
self.packet_src = gr.message_source(33)
- voice_decoder = gsm_full_rate.decode_ps()
+ voice_decoder = vocoder.gsm_fr_decode_ps()
s2f = gr.short_to_float ()
sink_scale = gr.multiply_const_ff(1.0/32767.)
audio_sink = audio.sink(sample_rate, audio_output_dev)
@@ -68,10 +65,25 @@ class my_top_block(gr.top_block):
self.rxpath = receive_path(demod_class, rx_callback, options)
self.audio_tx = audio_tx(options.audio_output)
- if(options.from_file is not None):
+ if(options.rx_freq is not None):
+ self.source = uhd_receiver(options.address, options.bitrate,
+ options.samples_per_symbol,
+ options.rx_freq, options.rx_gain,
+ options.antenna, options.verbose)
+ options.samples_per_symbol = self.source._sps
+
+ audio_rate = self.audio_tx.sample_rate
+ usrp_rate = self.source.get_sample_rate()
+ rrate = audio_rate / usrp_rate
+ self.resampler = blks2.pfb_arb_resampler_ccf(rrate)
+
+ self.connect(self.source, self.resampler, self.rxpath)
+
+ elif(options.from_file is not None):
self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate)
self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
self.connect(self.source, self.thr, self.rxpath)
+
else:
self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
self.source = gr.null_source(gr.sizeof_gr_complex)
@@ -117,6 +129,7 @@ def main():
parser.add_option("","--from-file", default=None,
help="input file of samples to demod")
receive_path.add_options(parser, expert_grp)
+ uhd_receiver.add_options(parser)
for mod in demods.values():
mod.add_options(expert_grp)