|
|
|
@ -84,7 +84,7 @@ class my_top_block(gr.top_block): |
|
|
|
|
parser.add_option("-f", "--file1", type="string", default=None, help="specify the input file slot 1") |
|
|
|
|
parser.add_option("-F", "--file2", type="string", default=None, help="specify the input file slot 2 (DMR)") |
|
|
|
|
parser.add_option("-g", "--gain", type="float", default=1.0, help="input gain") |
|
|
|
|
parser.add_option("-i", "--if-rate", type="float", default=960000, help="output rate to sdr") |
|
|
|
|
parser.add_option("-i", "--if-rate", type="int", default=960000, help="output rate to sdr") |
|
|
|
|
parser.add_option("-I", "--audio-input", type="string", default="", help="pcm input device name. E.g., hw:0,0 or /dev/dsp") |
|
|
|
|
parser.add_option("-N", "--gains", type="string", default=None, help="gain settings") |
|
|
|
|
parser.add_option("-O", "--audio-output", type="string", default="default", help="pcm output device name. E.g., hw:0,0 or /dev/dsp") |
|
|
|
@ -94,7 +94,8 @@ class my_top_block(gr.top_block): |
|
|
|
|
parser.add_option("-Q", "--frequency", type="float", default=0.0, help="Hz") |
|
|
|
|
parser.add_option("-r", "--repeat", action="store_true", default=False, help="input file repeat") |
|
|
|
|
parser.add_option("-R", "--fullrate-mode", action="store_true", default=False, help="ysf fullrate") |
|
|
|
|
parser.add_option("-s", "--sample-rate", type="int", default=48000, help="output sample rate") |
|
|
|
|
parser.add_option("-s", "--modulator-rate", type="int", default=48000, help="must be submultiple of IF rate") |
|
|
|
|
parser.add_option("-S", "--alsa-rate", type="int", default=48000, help="sound source/sink sample rate") |
|
|
|
|
parser.add_option("-t", "--test", type="string", default=None, help="test pattern symbol file") |
|
|
|
|
parser.add_option("-v", "--verbose", type="int", default=0, help="additional output") |
|
|
|
|
(options, args) = parser.parse_args() |
|
|
|
@ -145,10 +146,10 @@ class my_top_block(gr.top_block): |
|
|
|
|
if options.file2 and options.protocol == 'dmr': |
|
|
|
|
nfiles += 1 |
|
|
|
|
if nfiles < max_inputs and not options.test: |
|
|
|
|
AUDIO = audio.source(options.sample_rate, options.audio_input) |
|
|
|
|
lpf_taps = filter.firdes.low_pass(1.0, options.sample_rate, 3400.0, 3400 * 0.1, filter.firdes.WIN_HANN) |
|
|
|
|
AUDIO = audio.source(options.alsa_rate, options.audio_input) |
|
|
|
|
lpf_taps = filter.firdes.low_pass(1.0, options.alsa_rate, 3400.0, 3400 * 0.1, filter.firdes.WIN_HANN) |
|
|
|
|
audio_rate = 8000 |
|
|
|
|
AUDIO_DECIM = filter.fir_filter_fff (int(options.sample_rate / audio_rate), lpf_taps) |
|
|
|
|
AUDIO_DECIM = filter.fir_filter_fff (int(options.alsa_rate / audio_rate), lpf_taps) |
|
|
|
|
AUDIO_SCALE = blocks.multiply_const_ff(32767.0 * options.gain) |
|
|
|
|
AUDIO_F2S = blocks.float_to_short() |
|
|
|
|
self.connect(AUDIO, AUDIO_DECIM, AUDIO_SCALE, AUDIO_F2S) |
|
|
|
@ -172,13 +173,13 @@ class my_top_block(gr.top_block): |
|
|
|
|
else: |
|
|
|
|
self.connect(AUDIO_F2S, ENCODER2) |
|
|
|
|
|
|
|
|
|
MOD = p25_mod_bf(output_sample_rate = options.sample_rate, dstar = (options.protocol == 'dstar'), bt = options.bt, rc = RC_FILTER[options.protocol]) |
|
|
|
|
MOD = p25_mod_bf(output_sample_rate = options.modulator_rate, dstar = (options.protocol == 'dstar'), bt = options.bt, rc = RC_FILTER[options.protocol]) |
|
|
|
|
AMP = blocks.multiply_const_ff(output_gain) |
|
|
|
|
|
|
|
|
|
if options.output_file: |
|
|
|
|
OUT = blocks.file_sink(gr.sizeof_float, options.output_file) |
|
|
|
|
elif not options.args: |
|
|
|
|
OUT = audio.sink(options.sample_rate, options.audio_output) |
|
|
|
|
OUT = audio.sink(options.alsa_rate, options.audio_output) |
|
|
|
|
|
|
|
|
|
if options.protocol == 'dmr' and not options.test: |
|
|
|
|
self.connect(DMR, MOD) |
|
|
|
@ -186,8 +187,13 @@ class my_top_block(gr.top_block): |
|
|
|
|
self.connect(ENCODER, MOD) |
|
|
|
|
|
|
|
|
|
if options.args: |
|
|
|
|
f1 = float(options.if_rate) / options.modulator_rate |
|
|
|
|
i1 = int(options.if_rate / options.modulator_rate) |
|
|
|
|
if f1 - i1 > 1e-3: |
|
|
|
|
print '*** Error, sdr rate %d not an integer multiple of modulator rate %d - ratio=%f' % (options.if_rate, options.modulator_rate, f1) |
|
|
|
|
sys.exit(1) |
|
|
|
|
self.setup_sdr_output(options, mod_adjust[options.protocol]) |
|
|
|
|
interp = filter.rational_resampler_fff(options.if_rate / options.sample_rate, 1) |
|
|
|
|
interp = filter.rational_resampler_fff(options.if_rate / options.modulator_rate, 1) |
|
|
|
|
self.attn = blocks.multiply_const_cc(0.25) |
|
|
|
|
self.connect(MOD, AMP, interp, self.fm_modulator, self.attn, self.u) |
|
|
|
|
else: |
|
|
|
@ -212,7 +218,6 @@ class my_top_block(gr.top_block): |
|
|
|
|
print "setting gain %s to %d" % (name, gain) |
|
|
|
|
self.u.set_gain(gain, name) |
|
|
|
|
|
|
|
|
|
print 'setting sample rate' |
|
|
|
|
self.u.set_sample_rate(options.if_rate) |
|
|
|
|
self.u.set_center_freq(options.frequency) |
|
|
|
|
self.u.set_freq_corr(options.frequency_correction) |
|
|
|
|