From fde0c1432c470be1bc22faf4c6404f2572903c21 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sun, 12 Dec 2021 09:45:23 +1030 Subject: [PATCH] testing multiple frames per burst --- CMakeLists.txt | 4 ++-- test/001_highsnr_stdio_audio/test_tx.py | 19 +++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1482e366..ad48347e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ add_test(NAME 001_highsnr_stdio COMMAND sh -c "export LD_LIBRARY_PATH=${CODEC2_BUILD_DIR}/src; PATH=$PATH:${CODEC2_BUILD_DIR}/src; cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio; - python3 test_tx.py --mode 14 --delay 500 --frames 2 --bursts 1 | - freedv_data_raw_rx datac0 - - | hexdump -C") + python3 test_tx.py --mode 14 --delay 500 --frames 3 --bursts 1 | + freedv_data_raw_rx datac0 - - --framesperburst 3 | hexdump -C") set_tests_properties(001_highsnr_stdio PROPERTIES PASS_REGULAR_EXPRESSION "HELLO WORLD") diff --git a/test/001_highsnr_stdio_audio/test_tx.py b/test/001_highsnr_stdio_audio/test_tx.py index 95947722..d08cc09e 100644 --- a/test/001_highsnr_stdio_audio/test_tx.py +++ b/test/001_highsnr_stdio_audio/test_tx.py @@ -42,15 +42,6 @@ MODEM_SAMPLE_RATE = 8000 mode = args.FREEDV_MODE data_out = b'HELLO WORLD!' - - -print(N_BURSTS, file=sys.stderr) -print(N_FRAMES_PER_BURST, file=sys.stderr) - - - - - #-------------------------------------------- LOAD FREEDV libname = "libcodec2.so" @@ -102,7 +93,7 @@ crc = crc.value.to_bytes(2, byteorder='big') # convert crc to 2 byte hex string buffer += crc # append crc16 to buffer -print("BURSTS: " + str(N_BURSTS) + " FRAMES: " + str(N_FRAMES_PER_BURST) , file=sys.stderr) +print("BURSTS: " + str(N_BURSTS) + " FRAMES_PER_BURST: " + str(N_FRAMES_PER_BURST) , file=sys.stderr) for i in range(0,N_BURSTS): @@ -117,13 +108,14 @@ for i in range(0,N_BURSTS): c_lib.freedv_rawdatatx(freedv,mod_out,data) # modulate DATA and save it into mod_out pointer txbuffer += bytes(mod_out) - + print("frame",n, file=sys.stderr) + c_lib.freedv_rawdatapostambletx(freedv, mod_out_postamble) txbuffer += bytes(mod_out_postamble) - inter_burst_delay_ms = 200 - samples_delay = int(MODEM_SAMPLE_RATE*inter_burst_delay_ms/1000) + samples_delay = int(MODEM_SAMPLE_RATE*DELAY_BETWEEN_BURSTS) mod_out_silence = ctypes.c_short * samples_delay + print("samples_delay", samples_delay, "DELAY_BETWEEN_BURSTS", DELAY_BETWEEN_BURSTS, file=sys.stderr) mod_out_silence = mod_out_silence() txbuffer += bytes(mod_out_silence) @@ -134,7 +126,6 @@ for i in range(0,N_BURSTS): else: sys.stdout.buffer.write(txbuffer) # print data to terminal for piping the output to other programs sys.stdout.flush() - txbuffer = bytearray() if DATA_OUTPUT == "audio": stream_tx.close()