Skip to content

Commit

Permalink
Merge pull request ptrkrysik#224 from romankh/master
Browse files Browse the repository at this point in the history
option voice boundary detection in grgsm_decode
fix of grgsm_capture that stopped working after cahnges clock offset correction
  • Loading branch information
ptrkrysik authored Oct 2, 2016
2 parents 679a9bd + 1245b22 commit 9494c89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ build
.unittests
build/
debian/tmp/
debian/files
debian/files
.directory
7 changes: 6 additions & 1 deletion apps/grgsm_decode
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class grgsm_decoder(gr.top_block):
cfile=None, fc=None, samp_rate=2e6,
a5=1, a5_kc=None,
speech_file=None, speech_codec=None,
enable_voice_boundary_detection=False,
verbose=False,
print_bursts=False, ppm=0):

Expand All @@ -62,6 +63,7 @@ class grgsm_decoder(gr.top_block):
self.speech_codec = speech_codec
self.verbose = verbose
self.print_bursts = print_bursts
self.enable_voice_boundary_detection = enable_voice_boundary_detection

##################################################
# Blocks
Expand Down Expand Up @@ -95,7 +97,7 @@ class grgsm_decoder(gr.top_block):
self.sdcch8_demapper = grgsm.gsm_sdcch8_demapper(self.timeslot)
elif self.chan_mode == 'TCHF':
self.tch_f_demapper = grgsm.tch_f_chans_demapper(self.timeslot)
self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec)
self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec, enable_voice_boundary_detection)
self.tch_f_pdu_to_tagged_stream = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len")
self.tch_f_file_sink = blocks.file_sink(gr.sizeof_char*1, speech_file, False)

Expand Down Expand Up @@ -317,6 +319,8 @@ if __name__ == '__main__':
"Valid options are " + ", ".join(tch_codecs.keys()))
tch_options.add_option("-o", "--output-tch", dest="speech_output_file", default="/tmp/speech.au.gsm",
help="TCH/F speech output file [default=%default].")
tch_options.add_option("--voice-boundary", dest="enable_voice_boundary_detection", action="store_true",
help="Enable voice boundary detection for traffic channels. This can help reduce noice in the output.")
parser.add_option_group(tch_options)

# parse
Expand Down Expand Up @@ -378,6 +382,7 @@ if __name__ == '__main__':
cfile=options.cfile, fc=fc, samp_rate=options.samp_rate,
a5=options.a5, a5_kc=kc,
speech_file=options.speech_output_file, speech_codec=tch_codecs.get(options.speech_codec),
enable_voice_boundary_detection=options.enable_voice_boundary_detection,
verbose=options.verbose,
print_bursts=options.print_bursts, ppm=options.ppm)

Expand Down
4 changes: 2 additions & 2 deletions apps/helpers/grgsm_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None,
fc=fc,
samp_rate_in=samp_rate,
)
self.gsm_clock_offset_control = grgsm.clock_offset_control(fc-shiftoff, sample_rate, osr=4)
self.gsm_clock_offset_control = grgsm.clock_offset_control(fc-shiftoff, samp_rate, osr=4)

if self.burst_file:
self.gsm_burst_file_sink = grgsm.burst_file_sink(self.burst_file)
Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None,
if self.verbose or self.burst_file:
self.connect((self.gsm_input, 0), (self.gsm_receiver, 0))
self.connect((self.blocks_rotator, 0), (self.gsm_input, 0))
self.msg_connect(self.gsm_clock_offset_control, "ppm", self.gsm_input, "ppm_in")
self.msg_connect(self.gsm_clock_offset_control, "ctrl", self.gsm_input, "ctrl_in")
self.msg_connect(self.gsm_receiver, "measurements", self.gsm_clock_offset_control, "measurements")

if self.burst_file:
Expand Down

0 comments on commit 9494c89

Please sign in to comment.