added preamble transmission

pull/17/head
DJ2LS 2021-01-16 14:28:47 +01:00 committed by GitHub
parent f15e7dc3b5
commit a316126725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 17 deletions

View File

@ -145,26 +145,21 @@ class RF():
data = (ctypes.c_ubyte * bytes_per_frame).from_buffer_copy(buffer) data = (ctypes.c_ubyte * bytes_per_frame).from_buffer_copy(buffer)
self.c_lib.freedv_rawdatatx(freedv,mod_out,data) # modulate DATA and safe it into mod_out pointer self.c_lib.freedv_rawdatatx(freedv,mod_out,data) # modulate DATA and safe it into mod_out pointer
#print(bytes(mod_out).strip(b'\x00'))
# -------------- preamble area
#p = pyaudio.PyAudio() modulation = bytes(mod_out)
#stream_tx = p.open(format=pyaudio.paInt16, if mode == 7:
# channels=static.AUDIO_CHANNELS, mod_with_preamble = modulation[:len(modulation)] + modulation # double transmission in one audio burst
# rate=static.AUDIO_SAMPLE_RATE,
# frames_per_buffer=n_nom_modem_samples, if mode >= 10:
# output=True, mod_with_preamble = modulation[:0] + modulation # no preamble
# output_device_index=1, #static.AUDIO_OUTPUT_DEVICE
# )
audio = audioop.ratecv(mod_out,2,1,static.MODEM_SAMPLE_RATE, static.AUDIO_SAMPLE_RATE_TX, static.TX_SAMPLE_STATE) # -------------- audio sample rate conversion
audio = audioop.ratecv(mod_with_preamble,2,1,static.MODEM_SAMPLE_RATE, static.AUDIO_SAMPLE_RATE_TX, static.TX_SAMPLE_STATE)
# -------------- transmit audio
self.stream_tx.write(audio[0]) self.stream_tx.write(audio[0])
#print("KILL")
#stream_tx.stop_stream()
#stream_tx.close()
#p.terminate()
return mod_out return mod_out
#-------------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------------