diff --git a/mk_voice.py b/mk_voice.py index 05803b2..a06cf3c 100755 --- a/mk_voice.py +++ b/mk_voice.py @@ -63,6 +63,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase): EMBED.append(EMB['BURST_F'][:8] + NULL_EMB_LC + EMB['BURST_F'][-8:]) + #initialize the HBP calls stream sequence to 0 SEQ = 0 @@ -77,7 +78,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase): # Send each burst, six bursts per Superframe rotating through with the proper EMBED value per burst A-F for word in _phrase: for burst in range(0, len(word)): - pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst + 0][0] + EMBED[burst % 6] + word[burst + 0][1]).tobytes() + TAIL + pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst][0] + EMBED[burst % 6] + word[burst][1]).tobytes() + TAIL SEQ = (SEQ + 1) % 0x100 yield pkt @@ -93,7 +94,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase): if __name__ == '__main__': from time import time - speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['n0mjs']]) + speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['connected']]) while True: diff --git a/play_ambe.py b/play_ambe.py index 3c3c049..ccc87f8 100755 --- a/play_ambe.py +++ b/play_ambe.py @@ -95,8 +95,21 @@ class HBP(HBSYSTEM): print(int_id(_stream_id), int_id(self.last_stream)) self.last_stream = _stream_id - feedback = Thread(target=self.play_voice(bytes_3(3120101), bytes_3(2), bytes_4(3120119), 0, [words['kansas_link'],words['connected']])) - feedback.start() + #feedback = Thread(target=self.play_voice(bytes_3(3120101), bytes_3(2), bytes_4(3120119), 0, [words['connected']])) + #feedback.start() + + speech = pkt_gen(bytes_3(3120101), bytes_3(2), bytes_4(3120119), 0, [words['connected']]) + + sleep(4) + while True: + try: + pkt = next(speech) + except StopIteration: + break + sleep(.058) + dec = bhex(pkt) + print('TYPE:{} SEQ:{} SRC:{} DST:{} PEER:{} DMRBITS:{} STRID:{} PD1:{} EMB:{} PD2:{} TL:{}'.format(pkt[:4], pkt[4], int_id(pkt[5:8]), int_id(pkt[8:11]), int_id(pkt[11:15]), hex(pkt[15]), int_id(pkt[16:20]), bhex(pkt[20:34]), bhex(pkt[34:38]), bhex(pkt[38:-2]), bhex(pkt[-2:]))) + self.send_system(pkt)