Ignore type "errors."

This commit is contained in:
Paul Kronenwetter 2022-06-03 18:51:49 -04:00
parent ea356f963a
commit 80784d7114
2 changed files with 9 additions and 8 deletions

View file

@ -47,7 +47,7 @@ def util_rx():
AUDIO_SAMPLE_RATE_RX = 48000
# make sure our resampler will work
assert (AUDIO_SAMPLE_RATE_RX / MODEM_SAMPLE_RATE) == codec2.api.FDMDV_OS_48
assert (AUDIO_SAMPLE_RATE_RX / MODEM_SAMPLE_RATE) == codec2.api.FDMDV_OS_48 # type: ignore
# check if we want to use an audio device then do a pyaudio init
if AUDIO_INPUT_DEVICE != -1:
@ -125,7 +125,7 @@ def util_rx():
if AUDIO_INPUT_DEVICE != -1:
try:
# data_in48k = stream_rx.read(AUDIO_FRAMES_PER_BUFFER, exception_on_overflow = True)
data_in48k, overflowed = stream_rx.read(AUDIO_FRAMES_PER_BUFFER)
data_in48k, overflowed = stream_rx.read(AUDIO_FRAMES_PER_BUFFER) # type: ignore
except OSError as err:
print(err, file=sys.stderr)
# if str(err).find("Input overflowed") != -1:
@ -137,7 +137,7 @@ def util_rx():
data_in48k = sys.stdin.buffer.read(AUDIO_FRAMES_PER_BUFFER * 2)
# insert samples in buffer
x = np.frombuffer(data_in48k, dtype=np.int16)
x = np.frombuffer(data_in48k, dtype=np.int16) # type: ignore
# print(x)
# x = data_in48k
x.tofile(frx)
@ -165,7 +165,7 @@ def util_rx():
if rx_status & codec2.api.FREEDV_RX_BIT_ERRORS:
rx_errors = rx_errors + 1
if DEBUGGING_MODE:
rx_status = codec2.api.rx_sync_flags_to_text[rx_status]
rx_status = codec2.api.rx_sync_flags_to_text[rx_status] # type: ignore
time_needed = time_end - time_start
print(
@ -211,6 +211,7 @@ def util_rx():
if AUDIO_INPUT_DEVICE != -1:
sd._terminate()
def parse_arguments():
# --------------------------------------------GET PARAMETER INPUTS
parser = argparse.ArgumentParser(description="Simons TEST TNC")

View file

@ -35,7 +35,7 @@ def util_tx():
AUDIO_FRAMES_PER_BUFFER = 2400
MODEM_SAMPLE_RATE = codec2.api.FREEDV_FS_8000
AUDIO_SAMPLE_RATE_TX = 48000
assert (AUDIO_SAMPLE_RATE_TX % MODEM_SAMPLE_RATE) == 0
assert (AUDIO_SAMPLE_RATE_TX % MODEM_SAMPLE_RATE) == 0 # type: ignore
# check if we want to use an audio device then do a pyaudio init
if AUDIO_OUTPUT_DEVICE != -1:
@ -160,11 +160,11 @@ def util_tx():
# Check if we want to use an audio device or stdout
if AUDIO_OUTPUT_DEVICE != -1:
stream_tx.start()
stream_tx.write(txbuffer_48k)
stream_tx.start() # type: ignore
stream_tx.write(txbuffer_48k) # type: ignore
else:
# Print data to terminal for piping the output to other programs
sys.stdout.buffer.write(txbuffer_48k)
sys.stdout.buffer.write(txbuffer_48k) # type: ignore
sys.stdout.flush()
# and at last check if we had an opened audio instance and close it