removed audioop support

we want to test only the new buffer. Not sure if this is currently working
This commit is contained in:
dj2ls 2021-12-20 18:59:29 +01:00
parent b54463965a
commit 0ecaeaa2bb

View file

@ -9,7 +9,6 @@ import sys
import ctypes import ctypes
from ctypes import * from ctypes import *
import pathlib import pathlib
import audioop
#import asyncio #import asyncio
import logging, structlog, log_handler import logging, structlog, log_handler
import time import time
@ -392,12 +391,14 @@ class RF():
self.streambuffer += bytes(mod_out) self.streambuffer += bytes(mod_out)
self.streambuffer += bytes(mod_out_postamble) self.streambuffer += bytes(mod_out_postamble)
converted_audio = audioop.ratecv(self.streambuffer, 2, 1, self.MODEM_SAMPLE_RATE, self.AUDIO_SAMPLE_RATE_TX, None) # resample up to 48k (resampler works on np.int16)
self.streambuffer = bytes(converted_audio[0]) x = np.frombuffer(self.streambuffer, dtype=np.int16)
txbuffer_48k = self.resampler.resample8_to_48(x)
# append frame again with as much as in count defined # append frame again with as much as in count defined
for i in range(1, count): #for i in range(1, count):
self.streambuffer += bytes(converted_audio[0]) # self.streambuffer += bytes(txbuffer_48k.tobytes())
while self.ptt_and_wait(True): while self.ptt_and_wait(True):
pass pass
@ -406,7 +407,9 @@ class RF():
static.CHANNEL_STATE = 'SENDING_SIGNALLING' static.CHANNEL_STATE = 'SENDING_SIGNALLING'
# start writing audio data to audio stream # start writing audio data to audio stream
self.stream_tx.write(self.streambuffer) #self.stream_tx.write(self.streambuffer)
self.stream_tx.write(txbuffer_48k.tobytes())
# set ptt back to false # set ptt back to false
self.ptt_and_wait(False) self.ptt_and_wait(False)
@ -472,8 +475,9 @@ class RF():
self.c_lib.freedv_rawdatapostambletx(freedv, mod_out_postamble) self.c_lib.freedv_rawdatapostambletx(freedv, mod_out_postamble)
self.streambuffer += bytes(mod_out_postamble) self.streambuffer += bytes(mod_out_postamble)
converted_audio = audioop.ratecv(self.streambuffer, 2, 1, self.MODEM_SAMPLE_RATE, self.AUDIO_SAMPLE_RATE_TX, None) # resample up to 48k (resampler works on np.int16)
self.streambuffer = bytes(converted_audio[0]) x = np.frombuffer(self.streambuffer, dtype=np.int16)
txbuffer_48k = self.resampler.resample8_to_48(x)
# -------------- transmit audio # -------------- transmit audio
@ -484,7 +488,7 @@ class RF():
static.CHANNEL_STATE = 'SENDING_DATA' static.CHANNEL_STATE = 'SENDING_DATA'
# write audio to stream # write audio to stream
self.stream_tx.write(self.streambuffer) self.stream_tx.write(txbuffer_48k.tobytes())
static.CHANNEL_STATE = 'RECEIVING_SIGNALLING' static.CHANNEL_STATE = 'RECEIVING_SIGNALLING'