mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
more audio related work
This commit is contained in:
parent
8fbc9856db
commit
0be52c4948
|
@ -166,6 +166,7 @@ class ARQSessionISS(arq_session.ARQSession):
|
||||||
self.confirmed_bytes = self.total_length
|
self.confirmed_bytes = self.total_length
|
||||||
elif not fallback:
|
elif not fallback:
|
||||||
self.confirmed_bytes = self.expected_byte_offset
|
self.confirmed_bytes = self.expected_byte_offset
|
||||||
|
|
||||||
self.log(f"IRS confirmed {self.confirmed_bytes}/{self.total_length} bytes")
|
self.log(f"IRS confirmed {self.confirmed_bytes}/{self.total_length} bytes")
|
||||||
|
|
||||||
# check if we received an abort flag
|
# check if we received an abort flag
|
||||||
|
|
|
@ -225,7 +225,6 @@ def calculate_fft(data, fft_queue, states) -> None:
|
||||||
global RMS_COUNTER, CHANNEL_BUSY_DELAY
|
global RMS_COUNTER, CHANNEL_BUSY_DELAY
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
fftarray = np.fft.rfft(data)
|
fftarray = np.fft.rfft(data)
|
||||||
|
|
||||||
# Set value 0 to 1 to avoid division by zero
|
# Set value 0 to 1 to avoid division by zero
|
||||||
|
@ -322,8 +321,8 @@ def calculate_fft(data, fft_queue, states) -> None:
|
||||||
# erase queue if greater than 3
|
# erase queue if greater than 3
|
||||||
if fft_queue.qsize() >= 1:
|
if fft_queue.qsize() >= 1:
|
||||||
fft_queue = queue.Queue()
|
fft_queue = queue.Queue()
|
||||||
#fft_queue.put(dfftlist[:315]) # 315 --> bandwidth 3200
|
fft_queue.put(dfftlist[:315]) # 315 --> bandwidth 3200
|
||||||
fft_queue.put(dfftlist) # 315 --> bandwidth 3200
|
#fft_queue.put(dfftlist) # 315 --> bandwidth 3200
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(f"[MDM] calculate_fft: Exception: {err}")
|
print(f"[MDM] calculate_fft: Exception: {err}")
|
||||||
|
|
|
@ -162,7 +162,7 @@ class RF:
|
||||||
callback=self.sd_output_audio_callback,
|
callback=self.sd_output_audio_callback,
|
||||||
device=out_dev_index,
|
device=out_dev_index,
|
||||||
samplerate=self.AUDIO_SAMPLE_RATE,
|
samplerate=self.AUDIO_SAMPLE_RATE,
|
||||||
blocksize=512,
|
blocksize=600,
|
||||||
)
|
)
|
||||||
self.sd_output_stream.start()
|
self.sd_output_stream.start()
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ class RF:
|
||||||
self.tci_module.wait_until_transmitted(audio_48k)
|
self.tci_module.wait_until_transmitted(audio_48k)
|
||||||
else:
|
else:
|
||||||
# slice audio data to needed blocklength
|
# slice audio data to needed blocklength
|
||||||
block_size = 512
|
block_size = self.sd_output_stream.blocksize
|
||||||
pad_length = -len(audio_48k) % block_size
|
pad_length = -len(audio_48k) % block_size
|
||||||
padded_data = np.pad(audio_48k, (0, pad_length), mode='constant')
|
padded_data = np.pad(audio_48k, (0, pad_length), mode='constant')
|
||||||
sliced_audio_data = padded_data.reshape(-1, block_size)
|
sliced_audio_data = padded_data.reshape(-1, block_size)
|
||||||
|
|
Loading…
Reference in a new issue