mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Ignore type "errors."
This commit is contained in:
parent
ea356f963a
commit
80784d7114
2 changed files with 9 additions and 8 deletions
|
@ -47,7 +47,7 @@ def util_rx():
|
||||||
AUDIO_SAMPLE_RATE_RX = 48000
|
AUDIO_SAMPLE_RATE_RX = 48000
|
||||||
|
|
||||||
# make sure our resampler will work
|
# 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
|
# check if we want to use an audio device then do a pyaudio init
|
||||||
if AUDIO_INPUT_DEVICE != -1:
|
if AUDIO_INPUT_DEVICE != -1:
|
||||||
|
@ -125,7 +125,7 @@ def util_rx():
|
||||||
if AUDIO_INPUT_DEVICE != -1:
|
if AUDIO_INPUT_DEVICE != -1:
|
||||||
try:
|
try:
|
||||||
# data_in48k = stream_rx.read(AUDIO_FRAMES_PER_BUFFER, exception_on_overflow = True)
|
# 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:
|
except OSError as err:
|
||||||
print(err, file=sys.stderr)
|
print(err, file=sys.stderr)
|
||||||
# if str(err).find("Input overflowed") != -1:
|
# 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)
|
data_in48k = sys.stdin.buffer.read(AUDIO_FRAMES_PER_BUFFER * 2)
|
||||||
|
|
||||||
# insert samples in buffer
|
# insert samples in buffer
|
||||||
x = np.frombuffer(data_in48k, dtype=np.int16)
|
x = np.frombuffer(data_in48k, dtype=np.int16) # type: ignore
|
||||||
# print(x)
|
# print(x)
|
||||||
# x = data_in48k
|
# x = data_in48k
|
||||||
x.tofile(frx)
|
x.tofile(frx)
|
||||||
|
@ -165,7 +165,7 @@ def util_rx():
|
||||||
if rx_status & codec2.api.FREEDV_RX_BIT_ERRORS:
|
if rx_status & codec2.api.FREEDV_RX_BIT_ERRORS:
|
||||||
rx_errors = rx_errors + 1
|
rx_errors = rx_errors + 1
|
||||||
if DEBUGGING_MODE:
|
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
|
time_needed = time_end - time_start
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
@ -211,6 +211,7 @@ def util_rx():
|
||||||
if AUDIO_INPUT_DEVICE != -1:
|
if AUDIO_INPUT_DEVICE != -1:
|
||||||
sd._terminate()
|
sd._terminate()
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
# --------------------------------------------GET PARAMETER INPUTS
|
# --------------------------------------------GET PARAMETER INPUTS
|
||||||
parser = argparse.ArgumentParser(description="Simons TEST TNC")
|
parser = argparse.ArgumentParser(description="Simons TEST TNC")
|
||||||
|
|
|
@ -35,7 +35,7 @@ def util_tx():
|
||||||
AUDIO_FRAMES_PER_BUFFER = 2400
|
AUDIO_FRAMES_PER_BUFFER = 2400
|
||||||
MODEM_SAMPLE_RATE = codec2.api.FREEDV_FS_8000
|
MODEM_SAMPLE_RATE = codec2.api.FREEDV_FS_8000
|
||||||
AUDIO_SAMPLE_RATE_TX = 48000
|
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
|
# check if we want to use an audio device then do a pyaudio init
|
||||||
if AUDIO_OUTPUT_DEVICE != -1:
|
if AUDIO_OUTPUT_DEVICE != -1:
|
||||||
|
@ -160,11 +160,11 @@ def util_tx():
|
||||||
|
|
||||||
# Check if we want to use an audio device or stdout
|
# Check if we want to use an audio device or stdout
|
||||||
if AUDIO_OUTPUT_DEVICE != -1:
|
if AUDIO_OUTPUT_DEVICE != -1:
|
||||||
stream_tx.start()
|
stream_tx.start() # type: ignore
|
||||||
stream_tx.write(txbuffer_48k)
|
stream_tx.write(txbuffer_48k) # type: ignore
|
||||||
else:
|
else:
|
||||||
# Print data to terminal for piping the output to other programs
|
# 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()
|
sys.stdout.flush()
|
||||||
|
|
||||||
# and at last check if we had an opened audio instance and close it
|
# and at last check if we had an opened audio instance and close it
|
||||||
|
|
Loading…
Reference in a new issue